From 0c8bd4664cfd84eccfff36d72c03bbfb869f50ff Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Sat, 9 Dec 2023 14:50:52 +0100 Subject: [PATCH] Update infrastructure Signed-off-by: Bensuperpc --- Makefile | 7 +++---- README.md | 28 ++++++++++++++++++++++++++-- caddy/Caddyfile | 4 ++++ caddy/bensuperpc.org/Caddyfile | 8 ++++++++ docker-compose.yml | 19 +++++++++++++++++-- php.ini | 6 +++--- 6 files changed, 61 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 29f77f1..8b45760 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,9 @@ DOCKER := docker -PROFILES := webserver database wordpress adminer uptime-kuma +PROFILES := webserver database wordpress adminer uptime-kuma portainer PROFILE_CMD := $(addprefix --profile ,$(PROFILES)) - COMPOSE_FILES := $(shell find docker-compose*.yml | sed -e 's/^/--file /') AUTHOR := bensuperpc @@ -45,7 +44,7 @@ start-at: .PHONY: docker-check docker-check: - docker compose $(COMPOSE_FILES) $(PROFILES_CMD) config + docker compose $(COMPOSE_FILES) $(PROFILE_CMD) config .PHONY: stop stop: down @@ -70,7 +69,7 @@ state: update: git submodule update --init --recursive --remote git pull --recurse-submodules --all --progress - docker compose $(COMPOSE_FILES) $(PROFILES_CMD) pull + docker compose $(COMPOSE_FILES) $(PROFILE_CMD) pull .PHONY: clean clean: diff --git a/README.md b/README.md index 8411133..61f24e4 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ If you have any **questions** or **suggestions**, feel free to open an issue or - [x] Caddy - [x] Wordpress (Via FASTCGI/caddy) - [x] Adminer (MariaDB) +- [x] Portainer ce ## Screenshots @@ -29,7 +30,7 @@ If you have any **questions** or **suggestions**, feel free to open an issue or - [Docker Compose](https://docs.docker.com/compose/install/) - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) - [Web domain](https://www.ovh.com/world/domains/) (I use OVH) -- [Open port 80 and 443 on your router](http://192.168.0.1/) (I use a Orange box with default IP) +- [Open port 80 and 443 on your router](http://192.168.0.1/) (I use a SFR box with default IP) ### Clone @@ -45,7 +46,7 @@ Go to the folder cd infrastructure ``` -### Get the SSL certificate +### Configure the domain For all **bensuperpc.org**, you need to replace it with your domain, example: **mydomain.com** @@ -57,10 +58,23 @@ Check if all bensuperpc.* are replaced by your domain in [Caddyfile](caddy/wordp And then, caddy will generate the certificate for you and renew it automatically :D (It's easier than certbot and nginx) +| Domain name | Description | +| --- | --- | +| bensuperpc.org | Main domain | +| bensuperpc.com | Redirect to bensuperpc.org | +| bensuperpc.fr | Redirect to bensuperpc.org | +| bensuperpc.net | Redirect to bensuperpc.org | + ### Configure the infrastructure You need to configure the infrastructure with your own configuration. +You can generate a password with 32 characters: + +```sh +openssl rand -base64 32 +``` + For the [wordpress.env](env/wordpress.env) file, you need to change the password and user for the database. ```sh @@ -112,6 +126,16 @@ Remove countainers with: make down ``` +### All services + +You can find all services on the [docker-compose.yml](docker-compose.yml) file or on this table: + +| Service | Description | URL | +| --- | --- | --- | +| Wordpress | Wordpress website | [bensuperpc.org](https://bensuperpc.org) and [www.bensuperpc.org](https://www.bensuperpc.org) | +| Adminer | Adminer for MariaDB | [adminer.bensuperpc.org](https://adminer.bensuperpc.org) | +| Portainer ce | Portainer ce | [portainer.bensuperpc.org](https://portainer.bensuperpc.org) | + ## URL You can access to the website with: diff --git a/caddy/Caddyfile b/caddy/Caddyfile index bcc519e..134575c 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -1,3 +1,7 @@ +{ + email bensuperpc@gmail.com +} + import bensuperpc.org/Caddyfile import bensuperpc.com/Caddyfile import bensuperpc.net/Caddyfile diff --git a/caddy/bensuperpc.org/Caddyfile b/caddy/bensuperpc.org/Caddyfile index 542c24d..25e572d 100644 --- a/caddy/bensuperpc.org/Caddyfile +++ b/caddy/bensuperpc.org/Caddyfile @@ -34,3 +34,11 @@ adminer.bensuperpc.org { uptimekuma.bensuperpc.org { reverse_proxy uptime-kuma:3001 } + +portainer.bensuperpc.org { + reverse_proxy portainer:9000 +} + +rickroll.bensuperpc.org { + redir https://www.youtube.com/watch?v=dQw4w9WgXcQ permanent +} diff --git a/docker-compose.yml b/docker-compose.yml index 96a072c..f3aac10 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: # Webserver caddy: - image: caddy:alpine + image: caddy:latest container_name: webserver profiles: - webserver @@ -85,7 +85,7 @@ services: # - CHOWN uptime-kuma: - image: louislam/uptime-kuma:1 + image: louislam/uptime-kuma:latest container_name: uptime-kuma profiles: - uptime-kuma @@ -99,6 +99,19 @@ services: security_opt: - no-new-privileges:true + portainer: + image: portainer/portainer-ce:latest + container_name: portainer + profiles: + - portainer + restart: on-failure + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - portainer_data:/data + networks: + - blog-network + security_opt: + - no-new-privileges:true networks: blog-network: driver: bridge @@ -115,3 +128,5 @@ volumes: name: caddy_config uptimekuma_data: name: uptimekuma_data + portainer_data: + name: portainer_data diff --git a/php.ini b/php.ini index 94d7553..8e41a86 100644 --- a/php.ini +++ b/php.ini @@ -1,3 +1,3 @@ -memory_limit = 2048M -upload_max_filesize = 128M -post_max_size = 128M +memory_limit = 1024M +upload_max_filesize = 64M +post_max_size = 64M