Database afgesloten fout aan het einde van discourse docker setup

AI-generated summary

A user is setting up Discourse on AWS EC2 and encounters a database shutdown error during the Docker setup process. The logs show the PostgreSQL database shutting down as part of the process, but no actual error is visible. The user is concerned about email delivery issues, which are later identified as the real problem. The issue is traced to SendGrid, where the user needs to regenerate the API key by revoking the old one and creating a new application secret. Despite this, email delivery remains broken, prompting the user to seek further troubleshooting steps. shoaib_mohammed initially thought the database shutdown was an error, but the real issue is with email configuration. riking guides the user to regenerate the SendGrid API key and suggests consulting a troubleshooting guide for email issues on Discourse.

Hi team, I am trying to run the docker discourse set up on AWS EC2 by following this How to configure Discourse on Amazon Web services (AWS) - Axel Fernandes's blog

Everything except the last step went fine. Can you please suggest what is the error?

I, [2020-09-17T19:56:38.330642 #1]  INFO -- : File > /etc/nginx/letsencrypt.conf  chmod:   chown: 
I, [2020-09-17T19:56:38.334734 #1]  INFO -- : File > /etc/runit/1.d/letsencrypt  chmod: +x  chown: 
I, [2020-09-17T19:56:38.334916 #1]  INFO -- : Replacing (?-mix:ssl_certificate.+) with ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.cer;
ssl_certificate /shared/ssl/$$ENV_DISCOURSE_HOSTNAME_ecc.cer;
 in /etc/nginx/conf.d/discourse.conf
I, [2020-09-17T19:56:38.335173 #1]  INFO -- : Replacing (?-mix:#?ACCOUNT_EMAIL=.+) with ACCOUNT_EMAIL=$$ENV_LETSENCRYPT_ACCOUNT_EMAIL
 in /shared/letsencrypt/account.conf
I, [2020-09-17T19:56:38.335395 #1]  INFO -- : Replacing (?-mix:ssl_certificate_key.+) with ssl_certificate_key /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.key;
ssl_certificate_key /shared/ssl/$$ENV_DISCOURSE_HOSTNAME_ecc.key;
 in /etc/nginx/conf.d/discourse.conf
I, [2020-09-17T19:56:38.335982 #1]  INFO -- : Replacing (?-mix:add_header.+) with add_header Strict-Transport-Security 'max-age=63072000'; in /etc/nginx/conf.d/discourse.conf
I, [2020-09-17T19:56:38.336602 #1]  INFO -- : Replacing location @discourse { with location @discourse {
add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain in /etc/nginx/conf.d/discourse.conf
I, [2020-09-17T19:56:38.337288 #1]  INFO -- : > echo "Beginning of custom commands"
I, [2020-09-17T19:56:38.339060 #1]  INFO -- : Beginning of custom commands

I, [2020-09-17T19:56:38.339171 #1]  INFO -- : > echo "End of custom commands"
I, [2020-09-17T19:56:38.340989 #1]  INFO -- : End of custom commands

I, [2020-09-17T19:56:38.341091 #1]  INFO -- : Terminating async processes
I, [2020-09-17T19:56:38.341176 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgre
sql/12/bin/postmaster -D /etc/postgresql/12/main pid: 49
2020-09-17 19:56:38.341 UTC [49] LOG:  received fast shutdown request
I, [2020-09-17T19:56:38.341692 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 166
166:signal-handler (1600372598) Received SIGTERM scheduling shutdown...
2020-09-17 19:56:38.344 UTC [49] LOG:  aborting any active transactions
2020-09-17 19:56:38.347 UTC [49] LOG:  background worker "logical replication launcher" (PID 58) exited with exit code 1
2020-09-17 19:56:38.349 UTC [53] LOG:  shutting down
2020-09-17 19:56:38.416 UTC [49] LOG:  database system is shut down
166:M 17 Sep 2020 19:56:38.419 # User requested shutdown...
166:M 17 Sep 2020 19:56:38.419 * Saving the final RDB snapshot before exiting.
166:M 17 Sep 2020 19:56:38.423 * DB saved on disk
166:M 17 Sep 2020 19:56:38.424 # Redis is now ready to exit, bye bye...
sha256:80ffaa9115dbe8b1cfdc8d77dd25054e4fbd6be896fa19f6330448110e2e7251
68b73bf7854c91ff7e9cc5c7748e2826a85e6a6cdb62508d4b26cc9fc4cfd12d
Removing old container
+ /usr/bin/docker rm app
app

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -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 DISCO
URSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_HOSTNAME=testdiscourse.com -e DISCOURSE_DEVELOPER_EMAILS=sho_xxxxxx_92@gmail.com -e DISCOURSE_SMTP_ADDRESS=smtp.sendgr
id.net -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=SG.xxxxxx -e DISCOURSE_SMTP_PASSWORD=SG.xxxxxx -e LETSENCRYPT_ACCOUNT_EMAIL=me@example.com -h ip-172-31-4-9-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:3a:b7:1a:8e:ae local_discourse/app /sbin/boot

I don’t see any actual error in that log. It might be farther up or farther down.

I have removed the password from your post, but you should go to SendGrid and cycle the application secret.

You should be using a domain name you control.

@riking you are right. There is no actual error as such. But the send grid has an issue. Below is the config. What could be the issue ? Can you please explain what you meant cycle the application secret ? You mean to recreate ?

DISCOURSE_SMTP_ADDRESS: smtp.sendgrid.net
DISCOURSE_SMTP_PORT: 2525
DISCOURSE_SMTP_USER_NAME: apiKey
DISCOURSE_SMTP_PASSWORD: “SG.N6X4OZGjS_xxxxxx”

Wait, so email sending was the original issue?

Yes, you need to go to the SendGrid console, “revoke” the previous password you were using, and create a new one.

@riking There was no such issue actually initially. The log made me worried. But then i realised emails are not getting delivered.

@riking email seems to be still broken even after the new key. anything else should be taken care ?

Take a look at this howto guide and see if the steps there resolve the issue.