Question

Connect Directus Container on droplet to DO db

I am VERY new to this side of dev ops and am starting a company, so I am doing it all. Dev-Ops, software dev, and system administration.

I built the proof of concept and ran on local host using docker containers. We are now moving to a real deployment. We are using Directus for our CMS, and have been using a PSQL Docker container with persistent volume, however this seems dangerous as heck. We want to move away from the PSQL container and set up a DO PSQL db.

I have set up the DO db, migrated in our data. I can shell into the db from the droplet and see the data. The issues is when we go into the Directus env and roll over to the new configs it appears as they are not being picked up.

This is from the DO db logs:

[15-1] pid=999242,user=[unknown],db=[unknown],app=[unknown],client=10.1xx.x.x LOG: could not accept SSL connection: Success

this is the connection from Directus container trying to hit the db.

This is my config: (ignore the #, we rolled back but commented out)

# KEY=8D095490-..................
# SECRET=0A9B5BC3-.............................
# DB_CLIENT=pg
# DB_HOST=private-dev-postgres-do-user-xxxxxxxx-0.b.db.ondigitalocean.com
# DB_PORT=25060
# DB_DATABASE=xxxx-xxx-connection-pool
# DB_USER=aita
# DB_PASSWORD=AVNS_.....................
# DB_SSL__CA=/directus/DO-SSL/ca-certificate.crt
# STORAGE_LOCATIONS=digitalocean
# STORAGE_DIGITALOCEAN_DRIVER=s3
# STORAGE_DIGITALOCEAN_KEY=DIRECTUS-Access-DO
# STORAGE_DIGITALOCEAN_SECRET=Sm1cpr.......................
# STORAGE_DIGITALOCEAN_BUCKET=dev-postgres
# STORAGE_DIGITALOCEAN_REGION=NYC1
# PUBLIC_URL=https://admin.aiteachassist-dev.com
# ADMIN_EMAIL=xxxxxxxxxxxxxx@xxxxxxxxxxxx.com
# ADMIN_PASSWORD=a.........................2

from the Directus docs and the DO docs I cannot seem to find much outside of using a config in which DO apps is used when connecting to the db. Again we have a droplet that is running around 8 containers (3 of which will go away when we can get the db figured out; PSQL, Redis, and Mongo). If I can get the one handled the other 2 will be a breeze.

Any help of recommendations would be great.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
July 8, 2024

Hi there,

The error log that you’ve shared indicates that the issue is with the SSL cert. You would need to make sure your Directus container has the proper SSL certificate to connect to the DigitalOcean managed PostgreSQL database. I could suggest connecting to the container and verifying that the CA certificate actually exists at /directus/DO-SSL/ca-certificate.crt.

While connected to the container, make sure that the environment variables are being properly passed to the Directus container. You could use the printenv command to check that.

You can also, quickly test the connectivity from your container using psql:

docker exec -it <directus_container_id> bash
psql "host=private-dev-postgres-do-user-xxxxxxxx-0.b.db.ondigitalocean.com port=25060 dbname=xxxx-xxx-connection-pool user=aita password=AVNS_..................... sslmode=verify-full sslrootcert=/directus/DO-SSL/ca-certificate.crt"

Feel free to share your docker-compose file here so that I could try to spot any issues as well.

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel