Cómo configurar el certificado SSL gratuito de Let's Encrypt en una instancia de Discourse en Vultr

Hola,

¿Cómo puedo configurar un certificado SSL gratuito de Let’s Encrypt en una instancia de Discourse en Vultr?
Lo intenté durante la configuración, pero falló.

Acabo de configurar una instancia de $5 en VULTR con Ubuntu 18.04. Creé el siguiente registro DNS en Cloudflare:
image
Luego inicié sesión vía SSH e instalé las actualizaciones (apt update && apt upgrade). Reinicié. Después:

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

…se omitió mucho contenido…

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# 

Ahora, navega a http://test.freenas-community.org:


Como puedes ver, SSL está activo. El certificado es de Let’s Encrypt:

Todo lo anterior es una transcripción literal; las únicas ediciones son las direcciones de correo electrónico utilizadas para el administrador y para Let’s Encrypt, que se reemplazaron por (redacted). No te preocupes; esta instancia de Vultr y la configuración de dominio en Mailgun ya han sido destruidas.

Hola,

Pasé por los mismos pasos, todo salió bien. El registro fue similar al tuyo: Discourse installation for beginners but are willing to be part of the community - #61 by Earlie

Intenté abrir el enlace a tu instancia de Discourse y el resultado fue este: Screenshot by Lightshot

Como mencioné en mi publicación:

Esta instancia de Vultr y la configuración del dominio en Mailgun ya han sido destruidas.

Fue una prueba para asegurarme de que funcionaría (y funcionó). No hay nada único en un VPS de Vultr en comparación con DigitalOcean o Contabo (o, supongo, cualquier otro proveedor de VPS). Una vez confirmado, no quise gastar más dinero manteniendo el VPS en funcionamiento. Por lo tanto, el problema no es de documentación adecuada, ni está relacionado con Vultr. Los pasos en la documentación oficial (que se reducen a un git clone y ejecutar un script) funcionan perfectamente. Tal vez estás haciendo algo mal, tal vez hay algo único en tu instalación, o quizás ambas cosas son ciertas, pero la respuesta a la pregunta que planteas en el título es “sigue las instrucciones”.

Anteriormente, se instaló una instancia completa de Discourse (con SSL) en un dominio específico, utilizando las mismas configuraciones de Mailgun, Cloudflare y alojamiento. Esto fue realizado por otra persona para mí.

Más tarde, algo se rompió, así que decidí hacerlo yo mismo esta vez con el propósito práctico de aprender, para adquirir conocimientos no solo sobre cómo ejecutar Discourse, sino también sobre cómo ponerlo en marcha.

P.D.: Esta vez solo se cambió la dirección IP y se volvió a conectar al dominio en Cloudflare.