This guide will help you set up the CPT stack using Docker Compose. The stack includes the following services:
- PostgreSQL database
- CPT-API (backend API)
- CPT-Web (frontend web application)
- Traefik (reverse proxy and SSL/TLS certificate management)
- Docker and Docker Compose installed on your system
- A Cloudflare account and API key for managing DNS records
- Domain names for CPT-API and CPT-Web services
-
Copy the provided
docker-compose.ymlfile to a new directory on your system. -
Create a
.envfile in the same directory as thedocker-compose.ymlfile with the following variables:
API_URL=https://api.yourdomain.com
WEB_URL=https://yourdomain.com
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_postgres_password
TWO_FACTOR_AUTHENTICATION_APP_NAME=YourAppName
JWT_REFRESH_TTL=604800
JWT_AUTH_TTL=86400
JWT_SECRET=yoursupersecret
JWT_REFRESH_SECRET=yourothersupersecret
EMAIL_ADDRESS=your_email@example.com
EMAIL_PASSWORD=your_email_password
SMTP_SERVER=your_smtp_server
SMTP_PORT=your_smtp_server_port
SMTP_SECURE=true/false
Replace yourdomain.com with your actual domain, update the SMTP vars according to your SMTP server,
and set the POSTGRES_PASSWORD to a secure password.
Update the other variables as needed.
Place these files in the same directory as the docker-compose.yml file.
- Run
docker-compose up -dto start the containers with the new configuration. The services will be accessible at the following URLs:
- CPT-API:
http://localhost:8689 - CPT-Web:
http://localhost:80
API_URL=https://api.yourdomain.com
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_postgres_password
TWO_FACTOR_AUTHENTICATION_APP_NAME=YourAppName
JWT_REFRESH_TTL=604800
JWT_AUTH_TTL=86400
JWT_SECRET=yoursupersecret
JWT_REFRESH_SECRET=yourothersupersecret
EMAIL_ADDRESS=your_email@example.com
EMAIL_PASSWORD=your_email_password
SMTP_SERVER=your_smtp_server
SMTP_PORT=your_smtp_server_port
SMTP_SECURE=true/false
Replace the example values with your actual information.
You can customize the environment variables in the .env file as needed. See the provided example .env file for
reference.
If you encounter any issues or need further assistance, contact me