1. Caddy – Docker Compose:
1. Caddy – Docker Compose
Caddy is a lightweight web server that allows developers to deploy web applications with ease. It uses Docker Compose to manage containers and expose a single port to the public internet. Here’s a brief overview of how to use Caddy with Docker Compose:
- Install Caddy:
docker pull caddy
to download the latest version of Caddy.
- Create a Caddyfile: The Caddyfile is the configuration file that defines the server’s settings, such as the port to listen on, the database credentials, and the configuration files for other services. The Caddyfile is typically located in the root directory of the Docker Compose container and is in YAML format:
1. Caddy
– Docker Compose:
caddy:
image: caddy:2
container_name: caddy
ports:
- "80:80"
- "443:443"
volumes:
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./data/caddy:/data
- ./log/caddy:/var/log/caddy
- ./config/php:/usr/local/etc/php
- ./config/hello:/srv/hello
- ./src/laravel:/srv/laravel
depends_on:
- laravel
- phpmyadmin
- pgadmin
- gitlab
environment:
- DOMAIN=${DOMAIN}
– Caddyfile
{
email admin@{$DOMAIN}
log {
output file /var/log/caddy/access.log
level INFO
}
}
{$DOMAIN} {
root * /srv
encode gzip zstd
handle {
respond "Service not found" 404
}
}
2. PGAdmin
– Docker Compose:
postgres:
image: postgres:15
container_name: postgres
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin
environment:
- PGADMIN_DEFAULT_EMAIL=hyuken@gmail.com
- PGADMIN_DEFAULT_PASSWORD=admin
depends_on:
- postgres
– Caddyfile
handle_path /pgadmin/* {
reverse_proxy pgadmin:80 {
header_up X-Script-Name /pgadmin
header_up X-Scheme {scheme}
}
}
3. PHPMyAdmin
– Docker Compose:
mysql:
image: mysql:latest
container_name: mysql
volumes:
- ./data/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
- PMA_HOST=mysql
- PMA_USER=${MYSQL_USER}
- PMA_PASSWORD=${MYSQL_PASSWORD}
depends_on:
- mysql
– Caddyfile
handle_path /phpmyadmin/* {
reverse_proxy phpmyadmin:80
}