This commit is contained in:
Gilles Mouchet 2026-02-06 16:52:01 +01:00
parent 04fbf6b547
commit 3b46d1f1a1
2 changed files with 36 additions and 47 deletions

View File

@ -1,59 +1,56 @@
# Portainer # Wordpress
## Description ## Description
This docker compose run portainer on docker This docker compose run wordpress on docker
## Requierments ## Requierments
### Folder ### Folder
```bash ```bash
sudo mkdir -p /home/docker/portainer/data sudo mkdir -p /home/docker/wp/wp-site
sudo mkdir -p /home/docker/wp/wp-db
``` ```
### Certificats ### Certificats
Copy crt and key files on `/home/docker/certs/` Copy crt and key files on `/home/docker/certs/`
## Env file
## DB
Dans le script modifier le sql en fonction de l'environnement
A faire
## Run ## Run
```bash ```bash
docker compose up -d docker compose up -d
``` ```
## Config ## DB
By default the lifetime of the password is 8 hours. For modify goto **Settings** -> **Authentication** The base DB is ready
The maximum lifetime is 1 year
## Reset admin password
```bash
docker container stop portainer
docker run --rm -v /home/docker/portainer/data:/data portainer/helper-reset-password
...
2024/11/15 21:22:13 Password successfully updated for user: admin
2024/11/15 21:22:13 Use the following password to login: 9fB1`%r50ZVH:(XutQqm#M<_LE387,w2
```
## Apache ## Apache
### http-portainer.conf ### http-wp-dev.conf
``` ```
<VirtualHost *:80> <VirtualHost *:80>
ServerName portainer.gmotech.net ServerName wp-dev.gmolab.net
ServerAlias portainer ServerAlias wp-dev
CustomLog logs/portainer_access_log common CustomLog logs/wp-dev_access_log common
ErrorLog logs/portainer_error_log ErrorLog logs/wp-dev_error_log
# redirect to https # redirect to https
RewriteEngine on RewriteEngine on
RewriteCond %{SERVER_NAME} =portainer [OR] RewriteCond %{SERVER_NAME} =wp-dev [OR]
RewriteCond %{SERVER_NAME} =portainer.gmotech.net RewriteCond %{SERVER_NAME} =wp-devp.gmolab.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost> </VirtualHost>
``` ```
### https-portainer.conf ### https-wp-dev.conf
``` ```
## ##
## SSL Virtual Host Context ## SSL Virtual Host Context
## ##
# General setup for the virtual host # General setup for the virtual host
<VirtualHost *:443> <VirtualHost *:443>
ServerName portainer.gmotech.net ServerName wp-dev.gmolab.net
ServerAlias portainer ServerAlias wp-dev
CustomLog logs/portainer_access_log common CustomLog logs/wp-dev_access_log common
ErrorLog logs/portainer_error_log ErrorLog logs/wp-dev_error_log
# SSL # SSL
SSLEngine on SSLEngine on
@ -66,32 +63,22 @@ docker run --rm -v /home/docker/portainer/data:/data portainer/helper-reset-pass
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds) # HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
Header always set Strict-Transport-Security "max-age=63072000" Header always set Strict-Transport-Security "max-age=63072000"
# certificats # certificats
SSLCertificateFile "/etc/httpd/auth/cert/gmotech.net.crt" SSLCertificateFile "/etc/httpd/auth/cert/gmolab.net.crt"
SSLCertificateKeyFile "/etc/httpd/auth/cert/gmotech.net.key" SSLCertificateKeyFile "/etc/httpd/auth/cert/gmolab.net.key"
SSLCertificateChainFile "/etc/httpd/auth/cert/gmotechCA.crt" SSLCertificateChainFile "/etc/httpd/auth/cert/gmolabCA.crt"
# proxy # proxy
SSLProxyEngine On SSLProxyEngine On
ProxyPreserveHost On ProxyPreserveHost On
ProxyRequests off ProxyRequests off
ProxyPass "/" "http://127.0.0.1:9000/" ProxyPass "/" "http://127.0.0.1:8080/"
ProxyPassReverse "/" "https://127.0.0.1:9000/" ProxyPassReverse "/" "https://127.0.0.1:8080/"
</VirtualHost> </VirtualHost>
``` ```
## Access ## Access
https://portainer.gmotech.net https://wp-dev.gmolab.net
## Change Session lifetime
To TEST !! (one year)
## Sources
https://omar2cloud.github.io/rasp/psswd/
https://docs.portainer.io/admin/settings/authentication
### Changelog ### [1.0.0] - 2026-02-06
### [1.0.1] - 2025-08-23
#### Added
- config behind a proxy or not
---
### [1.0.0] - 2024-11-11
#### Added #### Added
- initial version by [GMo](mailto:gilles.mouchet@gmail.com) - initial version by [GMo](mailto:gilles.mouchet@gmail.com)

View File

@ -46,7 +46,7 @@ Usage: $scriptName <options>
Options: Options:
-a|--all stop docker compose, delete container and delete files in /home/docker/${root_app} -a|--all stop docker compose, delete container and delete files in /home/docker/${root_app}
-e|--env environment (gmolab or vdglab) -b|--bash Ouverture d'un shell 'root' dans le conteneur 'PHP-FPM'
-s|--stop stop docker compose -s|--stop stop docker compose
-u|--up start docker compose as daemon -u|--up start docker compose as daemon
-c|--console start docker compose as console -c|--console start docker compose as console
@ -79,7 +79,6 @@ if [ -z "$1" ]; then
exit exit
fi fi
while [[ "$#" -gt 0 ]]; do while [[ "$#" -gt 0 ]]; do
case "$1" in case "$1" in
-a|--all) -a|--all)
@ -99,7 +98,10 @@ while [[ "$#" -gt 0 ]]; do
docker compose up -d docker compose up -d
exit exit
;; ;;
-s|stop) -b|--bash)
docker exec --user root -it wp-site /bin/bash
;;
-s|--stop)
docker compose stop docker compose stop
;; ;;
-u|--up) -u|--up)