By juscheele
Below is the docker-compose file of my current development environment for a nest js app. It consists of a nest js api, mysql database. adminer and a nginx reverse proxy. It´s perfect for local development. However, i´struggling to deploy this to digital ocean. How would a setup for production look like?
version: '3.7'
services:
nest-api:
build:
context: server/.
target: build
environment:
- VIRTUAL_HOST=api.proto.io
- VIRTUAL_PORT=3000
- DB_HOST=db
command: npm run start:dev
ports:
- 3000:3000
volumes:
- ./server:/usr/src/app
- /usr/src/app/node_modules
depends_on:
- db
links:
- db
db:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=example
- MYSQL_DATABASE=proto
volumes:
- mysqldata:/var/lib/mysql
adminer:
image: adminer
restart: always
ports:
- 8080:8080
environment:
- VIRTUAL_HOST=db.proto.io
- VIRTUAL_PORT=8080
nginx:
container_name: proto-proxy
image: jwilder/nginx-proxy
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
ports:
- "8181:80"
volumes:
mysqldata:
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!
Hi there,
What I could suggest here is to use the DigitalOcean App Platform, that way you will not have to do any server configuration and maintenance.
The App Platform also comes with automatic builds and deployments so whenever you push your changes to GitHub, it will automatically trigger a new build and deployment.
Using the App Platform alongside DigitalOcean’s Managed Databases can significantly simplify your deployment process.
Here’s a quick guide for deploying your current setup to DigitalOcean’s App Platform along with a Managed Database:
DigitalOcean Managed Databases:
Modify Your Nest.js App Configuration:
DATABASE_URL environment variable or similar.Deploying Nest.js App on DigitalOcean App Platform:
DATABASE_URL from the managed database.Adminer:
Domain and HTTPS:
Continuous Deployment:
Scaling and Performance:
Monitoring & Logging:
Backup and Restore:
Security:
Using DigitalOcean’s App Platform and Managed Databases can significantly reduce the operational overhead compared to managing Docker and Docker Compose deployments yourself. This can let you focus more on development and less on infrastructure management.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.