A user is experiencing issues with their Discourse installation on a DigitalOcean droplet, as the site is not opening and returning a 502 Bad Gateway error. The problem appears to stem from an SSL setup issue, specifically related to Let’s Encrypt, with errors indicating missing certificate files and a missing LETSENCRYPT_ACCOUNT_EMAIL environment variable. After attempting to rebuild the app and fix the configuration, the user continues to face issues, possibly due to conflicting Nginx services running on the same server. The community suggests stopping or uninstalling Nginx, ensuring the correct environment variables are set in app.yml, and verifying that Docker is properly using ports 80 and 443. The user also considers backing up the existing Discourse data before setting up a fresh installation on a new droplet itamerlanium, Falco, tgxworld, riking, cpradio, sam, itamerlanium, itamerlanium, itamerlanium, itamerlanium, cpradio, itamerlanium, cpradio, itamerlanium, cpradio, itamerlanium, itamerlanium, cpradio, itamerlanium, cpradio, itamerlanium, itamerlanium.
root@discourse:~# ./launcher logs app
-su: ./launcher: No such file or directory
root@discourse:/# cd /shared/log/var-log/nginx
-su: cd: /shared/log/var-log/nginx: No such file or directory
The program exe (process ID 1304) is already listening on TCP port │
│ 443. This will prevent us from binding to that port. Please stop the │
│ exe program temporarily and then try again.
At least one of the (possibly) required ports is already taken.
root@discourse:/opt/letsencrypt# cd /etc/letsencrypt/live
-su: cd: /etc/letsencrypt/live: No such file or directory
root@discourse:/opt/letsencrypt# ls
acme letsencrypt-nginx
certbot letshelp-certbot
certbot-apache letshelp-letsencrypt
certbot-auto LICENSE.txt
certbot-compatibility-test linter_plugin.py
certbot-nginx MANIFEST.in
CHANGES.rst pep8.travis.sh
CONTRIBUTING.md README.rst
docker-compose.yml readthedocs.org.requirements.txt
Dockerfile setup.cfg
Dockerfile-dev setup.py
docs tests
examples tools
letsencrypt tox.cover.sh
letsencrypt-apache tox.ini
letsencrypt-auto Vagrantfile
letsencrypt-auto-source
And didn’t get a response similar to this:
Let’s Encrypt Output
IMPORTANT NOTES:
If you lose your account credentials, you can recover through
e-mails sent to sammy@example.com.
Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/discourse.example.com/fullchain.pem. Your
cert will expire on 2016-04-26. To obtain a new version of the
certificate in the future, simply run Let’s Encrypt again.
Your account credentials have been saved in your Let’s Encrypt
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Let’s
Encrypt so making regular backups of this folder is ideal.
Ups I missed it
I’ve resized the Droplet to 1Gb by the using SWAP and tried to rebuild it, but it didn’t help me. However, yesterday I rebuild it successfully.
if ($http_host != $$ENV_DISCOURSE_HOSTNAME) {
rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent;
} in /etc/nginx/conf.d/discourse.conf
I, [2016-07-27T06:45:30.779342 #13] INFO -- : > if [ -z "$LETSENCRYPT_ACCOUNT_EMAIL" ]; then echo "LETSENCRYPT_ACCOUNT_EMAIL ENV variable is required and has not been set."; exit 1; fi
I, [2016-07-27T06:45:30.782199 #13] INFO -- : LETSENCRYPT_ACCOUNT_EMAIL ENV variable is required and has not been set.
I, [2016-07-27T06:45:30.789702 #13] INFO -- : Terminating async processes
I, [2016-07-27T06:45:30.790433 #13] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 42
2016-07-27 06:45:30 UTC [42-2] LOG: received fast shutdown request
2016-07-27 06:45:30 UTC [42-3] LOG: aborting any active transactions
2016-07-27 06:45:30 UTC [49-2] LOG: autovacuum launcher shutting down
I, [2016-07-27T06:45:30.801912 #13] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 155
155:signal-handler (1469601930) Received SIGTERM scheduling shutdown...
2016-07-27 06:45:30 UTC [46-1] LOG: shutting down
2016-07-27 06:45:30 UTC [46-2] LOG: database system is shut down
155:M 27 Jul 06:45:30.851 # User requested shutdown...
155:M 27 Jul 06:45:30.852 * Saving the final RDB snapshot before exiting.
155:M 27 Jul 06:45:30.990 * DB saved on disk
155:M 27 Jul 06:45:30.990 # Redis is now ready to exit, bye bye...
FAILED
--------------------
Pups::ExecError: if [ -z "$LETSENCRYPT_ACCOUNT_EMAIL" ]; then echo "LETSENCRYPT_ACCOUNT_EMAIL ENV variable is required and has not been set."; exit 1; fi failed with return #<Process::Status: pid 3087 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cmd"=>["if [ -z \"$LETSENCRYPT_ACCOUNT_EMAIL\" ]; then echo \"LETSENCRYPT_ACCOUNT_EMAIL ENV variable is required and has not been set.\"; exit 1; fi", "/bin/bash -c \"if [[ ! \\\"$LETSENCRYPT_ACCOUNT_EMAIL\\\" =~ ([^@]+)@([^\\.]+) ]]; then echo \\\"LETSENCRYPT_ACCOUNT_EMAIL is not a valid email address\\\"; exit 1; fi\""]}
b723307a27a32d6c808e520b0cc3000fa2cbfe732291dd1bb312e7c9b8bfb375
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one
root@discourse:/var/discourse#