Comment configurer le certificat SSL gratuit Let's Encrypt sur une instance Discourse chez Vultr ?

Bonjour,

Je souhaiterais savoir comment configurer un certificat SSL gratuit Let’s Encrypt sur une instance Discourse hébergée chez Vultr.
J’ai tenté de le faire pendant l’installation, mais cela a échoué !

Je viens de configurer une instance à 5 $ sur VULTR avec Ubuntu 18.04. J’ai créé l’enregistrement DNS suivant sur Cloudflare :
image
Ensuite, je me suis connecté via SSH et j’ai installé les mises à jour (apt update && apt upgrade). J’ai redémarré le serveur. Puis :

root@test:~# git clone https://github.com/discourse/discourse_docker.git /var/discourse
Cloning into '/var/discourse'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 4545 (delta 7), reused 9 (delta 0), pack-reused 4523
Receiving objects: 100% (4545/4545), 981.86 KiB | 13.83 MiB/s, done.
Resolving deltas: 100% (2902/2902), done.
root@test:~# cd /var/discourse
root@test:/var/discourse# ./discourse-setup 
Docker not installed. Enter to install from https://get.docker.com/ or Ctrl+C to exit
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13185  100 13185    0     0  94856      0 --:--:-- --:--:-- --:--:-- 94856
# Executing docker install script, commit: 6bf300318ebaab958c4adc341a8c7bb9f3a54a1a
+ sh -c apt-get update -qq >/dev/null
+ sh -c apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
+ [ -n  ]
+ sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
+ sh -c docker version
Client: Docker Engine - Community
 Version:           19.03.2
 API version:       1.40
 Go version:        go1.12.8
 Git commit:        6a30dfc
 Built:             Thu Aug 29 05:29:11 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.2
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.8
  Git commit:       6a30dfc
  Built:            Thu Aug 29 05:27:45 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker your-user

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.
WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM
or less. This system does not appear to have sufficient swap space.

Without sufficient swap space, your site may not work properly, and future
upgrades of Discourse may not complete successfully.

Ctrl+C to exit or wait 5 seconds to have a 2GB swapfile created.
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=7296ed32-7333-4a05-96c2-a5814d9e933b
/swapfile       swap    swap    auto      0       0
vm.swappiness = 10
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
Found 1GB of memory and 1 physical CPU cores
setting db_shared_buffers = 128MB
setting UNICORN_WORKERS = 2
containers/app.yml memory parameters updated.

Hostname for your Discourse? [discourse.example.com]: test.freenas-community.org
Email address for admin account(s)? [me@example.com,you@example.com]: danb35@gmail.com
SMTP server address? [smtp.example.com]: smtp.mailgun.org
SMTP port? [587]: 
SMTP user name? [postmaster@test.freenas-community.org]: 
SMTP password? [pa$$word]: 05ef745f09d198eee105b2cddbe424f1-bbbc8336-a4d37742
Optional email address for setting up Let's Encrypt? (ENTER to skip) [me@example.com]: danb35@gmail.com

Checking your domain name . . .

Connection to test.freenas-community.org succeeded.

Does this look right?

Hostname      : test.freenas-community.org
Email         : (redacted)
SMTP address  : smtp.mailgun.org
SMTP port     : 587
SMTP username : postmaster@test.freenas-community.org
SMTP password : 05ef745f09d198eee105b2cddbe424f1-bbbc8336-a4d37742
Let's Encrypt : (redacted)

ENTER to continue, 'n' to try again, Ctrl+C to exit: 
Let's Encrypt will be enabled for (redacted)
web.ssl.template.yml enabled

…suite de nombreuses informations…

2019-09-17 23:56:10.984 UTC [64] LOG:  received fast shutdown request
181:signal-handler (1568764570) Received SIGTERM scheduling shutdown...
181:M 17 Sep 2019 23:56:10.987 # User requested shutdown...
181:M 17 Sep 2019 23:56:10.987 * Saving the final RDB snapshot before exiting.
2019-09-17 23:56:10.988 UTC [64] LOG:  aborting any active transactions
2019-09-17 23:56:10.998 UTC [64] LOG:  worker process: logical replication launcher (PID 73) exited with exit code 1
2019-09-17 23:56:11.006 UTC [68] LOG:  shutting down
181:M 17 Sep 2019 23:56:11.006 * DB saved on disk
181:M 17 Sep 2019 23:56:11.007 # Redis is now ready to exit, bye bye...
2019-09-17 23:56:11.342 UTC [64] LOG:  database system is shut down
sha256:9902b3b87ef8554416de9bd18cb319d16f3f987a708a59a72bd03a119a04bd9c
715b777d15bc45a61960ab68e9356556b6fe6555ed93a319cb0f65d856d1fa4d

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=2 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_HOSTNAME=test.freenas-community.org -e DISCOURSE_DEVELOPER_EMAILS=danb35@gmail.com -e DISCOURSE_SMTP_ADDRESS=smtp.mailgun.org -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=postmaster@test.freenas-community.org -e DISCOURSE_SMTP_PASSWORD=05ef745f09d198eee105b2cddbe424f1-bbbc8336-a4d37742 -e LETSENCRYPT_ACCOUNT_EMAIL=danb35@gmail.com -h test-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:fb:6d:f6:c7:45 local_discourse/app /sbin/boot
2b1d2b621a42c553eb753cdfb5c67c0d2af7fc50e1eefc22d7c7f8fc47c1d2ed
root@test:/var/discourse# 

Maintenant, naviguez vers http://test.freenas-community.org :


Comme vous pouvez le voir, SSL est actif. Le certificat provient de Let’s Encrypt :

Tout ce qui est affiché ci-dessus est une copie conforme ; les seules modifications sont l’adresse e-mail utilisée pour l’administrateur et pour Let’s Encrypt, qui ont été remplacées par (redacted). Ne vous inquiétez pas ; cette instance Vultr et la configuration du domaine sur Mailgun ont déjà été supprimées.

Bonjour,

J’ai suivi les mêmes étapes, tout s’est bien passé, le journal était similaire au vôtre : Discourse installation for beginners but are willing to be part of the community - #61 by Earlie
J’ai essayé d’ouvrir le lien vers votre instance Discourse, et le résultat est Screenshot by Lightshot

Comme je l’ai dit dans mon message :

cette instance Vultr et la configuration du domaine sur Mailgun ont déjà été supprimées.

C’était un test pour vérifier que cela fonctionnerait (ce qui est le cas). Il n’y a rien de particulier entre un VPS Vultr et DigitalOcean ou Contabo (ou, je m’y attends, n’importe quel autre fournisseur de VPS), et après l’avoir confirmé, je ne voulais pas dépenser plus d’argent pour maintenir le VPS en activité. Le problème ne vient donc pas d’une documentation inadéquate. Ce n’est pas un problème lié à Vultr. Les étapes de la documentation officielle (qui se résument à un git clone et à l’exécution d’un script) fonctionnent parfaitement. Peut-être faites-vous quelque chose de mal, peut-être y a-t-il quelque chose de spécifique à votre installation, ou peut-être les deux sont-ils vrais, mais la réponse à la question que vous posez dans l’objet est « suivez les instructions ».

Une instance Discourse complète (avec SSL) avait été installée précédemment sur un domaine spécifique, avec les mêmes paramètres Mailgun, Cloudflare et d’hébergement. Cette installation avait été réalisée par une autre personne pour moi.
J’ai ensuite fait une erreur, j’ai donc décidé de le faire moi-même cette fois-ci à des fins d’apprentissage pratique, afin de comprendre non seulement comment exécuter Discourse, mais aussi comment le faire fonctionner correctement.
P.S. Seule l’adresse IP a été changée cette fois, et le domaine a été re-connecté dans Cloudflare.