您好,
我想了解如何在 Vultr 上的 Discourse 实例中设置 Let’s Encrypt 免费 SSL 证书?
我在安装过程中尝试过,但失败了!
您好,
我想了解如何在 Vultr 上的 Discourse 实例中设置 Let’s Encrypt 免费 SSL 证书?
我在安装过程中尝试过,但失败了!
我刚刚在 VULTR 上创建了一台 5 美元的实例,运行 Ubuntu 18.04。随后在 Cloudflare 上创建了以下 DNS 记录:
![]()
然后通过 SSH 登录并安装了更新(apt update && apt upgrade),之后重启了系统。接着执行了以下操作:
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
……省略大量内容……
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#
现在,访问 http://test.freenas-community.org:
以上输出内容均为原文,唯一的修改是将用于管理员账户和 Let’s Encrypt 的电子邮件地址替换为“(redacted)”。请放心,这台 Vultr 实例以及 Mailgun 上的域名配置都已被销毁。
你好,
我按照相同的步骤操作,一切顺利,日志与你的类似:Discourse installation for beginners but are willing to be part of the community - #61 by Earlie
我尝试打开你 Discourse 实例的链接,结果是:Screenshot by Lightshot
正如我在帖子中所述:
该 Vultr 实例和 Mailgun 上的域名配置已被销毁。
那只是一个测试,以确保它能正常工作(确实如此)。Vultr VPS 与 DigitalOcean 或 Contabo(或者我预计任何其他 VPS 提供商)相比并没有什么独特之处。在确认这一点后,我不想再花钱让 VPS 继续运行。因此,问题不在于文档是否恰当,也不在于 Vultr 本身。官方文档中的步骤(实际上就是 git clone 并运行一个脚本)完全可行。也许你操作有误,也许你的安装环境有特殊之处,或者两者兼有,但对你在标题中提出的问题,答案就是“按照说明操作”。
此前,某个特定域名上已安装过一个功能完备(含 SSL)的 Discourse 实例,当时也配置了相同的 Mailgun、Cloudflare 和主机设置。该实例是由他人代为安装的。
后来我弄坏了一些东西,因此这次决定亲自动手,出于实践学习的目的,以便不仅了解如何运行 Discourse,还能掌握如何将其部署上线。
附注:此次仅更改了 IP 地址,并在 Cloudflare 中重新连接到了该域名。