Setting Up Docker Containers with Portainer | Part 5 - Chuck Builds A Website
Welcome to Episode 5 of the 'Chuck Builds A Website' series! In this video, I'm diving deep into setting up Docker containers using Portainer for our professional website stack.
Welcome to Episode 5 of the 'Chuck Builds A Website' series! In this video, I'm diving deep into setting up Docker containers using Portainer for our professional website stack.
Here's what you'll learn:
- Understanding the structure of a Docker Compose file
- Setting up containers for Ghost, MySQL, PostgreSQL, Caddy, and more
- How to securely manage passwords and environment variables
- Using Putty for SSH access to generate encryption keys
- Tips for customizing your stack for your specific domain
Whether you're building a website for a nonprofit, small business, or personal project, this guide will help you set up a robust and secure hosting environment.
I'll walk you through each step, explaining the purpose of each container and how they work together.
Below is the docker compose for the stack.
I tried to make it so it was easy to "Replace All Occurrences" or "Find and Replace", but if you have any confusion or questions just let me know.
Please note where I have added " CHANGE_ME" for changing passwords and "DOMAIN" for updating the placeholder with your domain.
services:
mysql:
image: mysql:8.0
container_name: mysql
restart: always
environment:
MYSQL_DATABASE: ghost
MYSQL_USER: ghost
MYSQL_PASSWORD: mysql_db_password_CHANGE_ME
MYSQL_ROOT_PASSWORD: mysql_root_password_CHANGE_ME
volumes:
- mysql_data:/var/lib/mysql
ports:
- "3306:3306"
postgresql:
image: postgres:latest
container_name: postgresql
restart: always
environment:
POSTGRES_DB: formbricks
POSTGRES_USER: postgres_user_CHANGE_ME
POSTGRES_PASSWORD: postgres_password_CHANGE_ME
volumes:
- postgresql_data:/var/lib/postgresql/data
ports:
- "5432:5432"
ghost:
image: ghost:latest
container_name: ghost
restart: always
environment:
database__client: mysql
database__connection__host: mysql
database__connection__user: ghost
database__connection__password: mysql_db_password_CHANGE_ME
database__connection__database: ghost
url: https://www.YOURDOMAIN.com/
mail__transport: SMTP
mail__options__service: Mailgun
mail__options__auth__user: [email protected]
mail__options__auth__pass: MAILGUN_SMTP_PASSWORD
mail__options__port: 587
mail__options__secure: false
mail__options__host: smtp.mailgun.org
mail__from: [email protected]
NODE_ENV: production
volumes:
- ghost_content:/var/lib/ghost/content
ports:
- 2368:2368
depends_on:
- mysql
caddy:
image: caddy:latest
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- caddy_file:/etc/caddy/
- caddy_data:/data
- caddy_config:/config
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: always
environment:
DB_TYPE: sqlite
DB_SQLITE_VACUUM_ON_STARTUP: 'true'
N8N_BASIC_AUTH_ACTIVE: 'true'
N8N_BASIC_AUTH_USER: 'n8n_username_CHANGE_ME'
N8N_BASIC_AUTH_PASSWORD: 'n8n_password_CHANGE_ME'
WEBHOOK_URL: https://n8n.YOURDOMAIN.com/
GENERIC_TIMEZONE: 'America/Chicago'
volumes:
- n8n_data:/home/node/.n8n
ports:
- 5678:5678
redis:
image: redis:7.0
container_name: redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
restart: unless-stopped
formbricks:
image: formbricks/formbricks:latest
container_name: formbricks
restart: always
environment:
DATABASE_URL: "postgresql://postgres_user_CHANGE_ME:postgres_password_CHANGE_ME@postgresql:5432/formbricks"
NEXTAUTH_URL: "https://formbricks.YOURDOMAIN.com"
NEXTAUTH_SECRET: openssl rand -hex 32
MAIL_FROM: [email protected]
SMTP_HOST: smtp.mailgun.org
SMTP_PORT: 587
SMTP_SECURE_ENABLED: 0
SMTP_USER: [email protected]
SMTP_PASSWORD: MAILGUN_SMTP_PASSWORD
NEXT_PUBLIC_EMAIL_VERIFICATION_DISABLED: 0
NEXT_PUBLIC_PASSWORD_RESET_DISABLED: 0
CRON_SECRET: openssl rand -hex 32
NODE_ENV: production
ENCRYPTION_KEY: openssl rand -hex 32
WEBAPP_URL: https://formbricks.YOURDOMAIN.com
REDIS_URL: redis://redis:6379
depends_on:
- redis
volumes:
- formbricks_data:/app/data
ports:
- 3000:3000
filebrowser:
image: filebrowser/filebrowser:latest
container_name: filebrowser
restart: always
environment:
FB_AUTH: password
volumes:
- filebrowser_data:/srv
- ghost_content:/srv/ghost_content
- caddy_file:/srv/caddy_file
ports:
- 8080:80
volumes:
mysql_data:
postgresql_data:
ghost_content:
caddy_data:
caddy_config:
caddy_file:
n8n_data:
formbricks_data:
filebrowser_data:
redis_data: