Add Web-Servers

This commit is contained in:
James Turland 2023-09-22 15:15:16 +01:00
parent 6e00e0aa3f
commit 9075891c75
5 changed files with 149 additions and 0 deletions

View file

@ -0,0 +1,29 @@
## MAKE SURE YOU RUN THE SITE BUILD COMMAND FIRST, BEFORE DEPLOYING THIS CONTAINER ##
## YOU NEED TO MOUNT THE SITE DURING THE HUGO DEPLOYMENT ##
version: '3.8'
services:
server:
image: klakegg/hugo:0.101.0
container_name: hugo
command: server
volumes:
- "/home/ubuntu/docker/hugo/your-website:/src" #mount your site here after you've created a new site!
networks:
proxy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.hugo.entrypoints=http"
- "traefik.http.routers.hugo.rule=Host(`mywebsite.yourdomain.com`)"
- "traefik.http.middlewares.hugo-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.hugo.middlewares=hugo-https-redirect"
- "traefik.http.routers.hugo-secure.entrypoints=https"
- "traefik.http.routers.hugo-secure.rule=Host(`mywebsite.yourdomain.com`)"
- "traefik.http.routers.hugo-secure.tls=true"
- "traefik.http.routers.hugo-secure.service=hugo"
- "traefik.http.services.hugo.loadbalancer.server.port=1313"
- "traefik.docker.network=proxy"
networks:
proxy:
external: true

View file

@ -0,0 +1 @@
sudo docker run --rm -v $(pwd):/src klakegg/hugo:0.101.0-ext-alpine new site MyWebsite --format yaml

View file

@ -0,0 +1,32 @@
version: "3.9"
services:
web:
image: nginx
container_name: nginx
volumes:
- /home/ubuntu/docker/nginx/templates:/etc/nginx/templates
- /home/ubuntu/docker/nginx/web:/usr/share/nginx/html
environment:
- NGINX_HOST=mydomain.com
- NGINX_PORT=80
labels:
- "traefik.enable=true"
- "traefik.http.routers.nginx.entrypoints=http"
- "traefik.http.routers.nginx.rule=Host(`my.website.com`)"
- "traefik.http.middlewares.nginx-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.nginx.middlewares=nginx-https-redirect"
- "traefik.http.routers.nginx-secure.entrypoints=https"
- "traefik.http.routers.nginx-secure.rule=Host(`my.website.com`)"
- "traefik.http.routers.nginx-secure.tls=true"
- "traefik.http.routers.nginx-secure.service=nginx"
- "traefik.http.services.nginx.loadbalancer.server.port=80"
# - "traefik.http.routers.nginx-secure.middlewares=middlewares-authentik@file"
- "traefik.docker.network=proxy"
networks:
proxy:
security_opt:
- no-new-privileges:true
networks:
proxy:
external: true

View file

@ -0,0 +1,4 @@
IP=192.168.200.50
PORT=8074
DB_ROOT_PASSWORD=password
DB_NAME=wordpress

View file

@ -0,0 +1,83 @@
version: '3'
services:
wp:
image: wordpress:latest # https://hub.docker.com/_/wordpress/
volumes:
- /home/ubuntu/docker/wordpress/config/php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
- /home/ubuntu/docker/wordpress/wp-app:/var/www/html # Full wordpress project
#- ./plugin-name/trunk/:/var/www/html/wp-content/plugins/plugin-name # Plugin development
#- ./theme-name/trunk/:/var/www/html/wp-content/themes/theme-name # Theme development
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: "${DB_NAME}"
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: "${DB_ROOT_PASSWORD}"
depends_on:
- db
links:
- db
networks:
proxy:
wordpress:
labels:
- "traefik.enable=true"
- "traefik.http.routers.wordpress.entrypoints=http"
- "traefik.http.routers.wordpress.rule=Host(`wordpress.your-domain.co.uk`)"
- "traefik.http.middlewares.wordpress-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.wordpress.middlewares=wordpress-https-redirect"
- "traefik.http.routers.wordpress-secure.entrypoints=https"
- "traefik.http.routers.wordpress-secure.rule=Host(`wordpress.your-domain.co.uk`)"
- "traefik.http.routers.wordpress-secure.tls=true"
- "traefik.http.routers.wordpress-secure.service=wordpress"
- "traefik.http.services.wordpress.loadbalancer.server.port=80"
- "traefik.docker.network=proxy"
pma:
image: phpmyadmin/phpmyadmin
environment:
# https://docs.phpmyadmin.net/en/latest/setup.html#docker-environment-variables
PMA_HOST: db
PMA_PORT: 3306
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
UPLOAD_LIMIT: 50M
links:
- db:db
networks:
proxy:
wordpress:
labels:
- "traefik.enable=true"
- "traefik.http.routers.pma.entrypoints=http"
- "traefik.http.routers.pma.rule=Host(`pma.your-domain.co.uk`)"
- "traefik.http.middlewares.pma-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.pma.middlewares=pma-https-redirect"
- "traefik.http.routers.pma-secure.entrypoints=https"
- "traefik.http.routers.pma-secure.rule=Host(`pma.your-domain.co.uk`)"
- "traefik.http.routers.pma-secure.tls=true"
- "traefik.http.routers.pma-secure.service=pma"
- "traefik.http.services.pma.loadbalancer.server.port=80"
- "traefik.docker.network=proxy"
db:
image: mysql:latest # https://hub.docker.com/_/mysql/ - or mariadb https://hub.docker.com/_/mariadb
ports:
- ${IP}:3306:3306 # change ip if required
command: [
'--default_authentication_plugin=mysql_native_password',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci'
]
volumes:
- /home/ubuntu/docker/wordpress/wp-data:/docker-entrypoint-initdb.d
- /home/ubuntu/docker/wordpress/db_data:/var/lib/mysql
environment:
MYSQL_DATABASE: "${DB_NAME}"
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
networks:
wordpress:
networks:
wordpress:
proxy:
external: true