Implemented postgress

This commit is contained in:
Kevin Veen-Birkenbach 2023-12-06 11:36:18 +01:00
parent e40a23cb8f
commit f1160a6ef0
3 changed files with 39 additions and 28 deletions

View File

@ -1,42 +1,41 @@
# Docker MyBB Role # Role Name: Docker MyBB
This README documents the Ansible role for setting up a MyBB forum using Docker. The role automates the deployment of MyBB, a free and open-source forum software, using Docker containers and manages the necessary configurations and dependencies. ## Dependencies
## Role Name: Docker MyBB
### Dependencies
- nginx-docker-reverse-proxy - nginx-docker-reverse-proxy
### Variables ## Variables
- `docker_compose_instance_directory`: The directory where Docker Compose files for MyBB are stored. - `docker_compose_instance_directory`: The directory where Docker Compose files for MyBB are stored.
- `conf_d_docker_directory`: Directory for Docker Nginx configuration. - `conf_d_docker_directory`: Directory for Docker Nginx configuration.
- `default_conf_server_file`: The default Nginx configuration file for the server. - `default_conf_server_file`: The default Nginx configuration file for the server.
- `conf_d_server_directory`: The Nginx server's configuration directory. - `conf_d_server_directory`: The Nginx server's configuration directory.
### Tasks ## Tasks
1. **Domain Certificate Retrieval:** Automates the process of obtaining SSL certificates for the specified domain using Certbot. 1. **Domain Certificate Retrieval:** Automates the process of obtaining SSL certificates for the specified domain using Certbot.
2. **Nginx Configuration:** Handles the configuration of Nginx for the MyBB domain. 2. **Nginx Configuration:** Handles the configuration of Nginx for the MyBB domain.
3. **Directory Creation:** Ensures the creation of necessary directories including parent directories as required. 3. **Directory Creation:** Ensures the creation of necessary directories including parent directories as required.
4. **MyBB and Nginx Configuration:** Manages the configuration for MyBB and Nginx, including setting up the `default.conf` file. 4. **MyBB and Nginx Configuration:** Manages the configuration for MyBB and Nginx, including setting up the `default.conf` file.
5. **Docker Compose Setup:** Adds and manages the `docker-compose.yml` file necessary for running MyBB with Docker. 5. **Docker Compose Setup:** Adds and manages the `docker-compose.yml` file necessary for running MyBB with Docker.
### Usage ## Usage
#### Install Plugins ### Install Plugins
To install MyBB plugins, extract them to a mounted volume and sync using the provided `docker run` command To install MyBB plugins, extract them to a mounted volume and sync using the provided `docker run` command
```bash ```bash
docker run --rm -v mybb-data:/target/ -v /mnt/:/origin/ "kevinveenbirkenbach/alpine-rsync" sh -c "rsync -avv /origin/inc/plugins/ /target/" docker run --rm -v mybb-data:/target/ -v /mnt/:/origin/ "kevinveenbirkenbach/alpine-rsync" sh -c "rsync -avv /origin/inc/plugins/ /target/"
``` ```
#### Running the Role ### Running the Role
Execute the Ansible playbook containing this role to set up MyBB in a Docker environment. Execute the Ansible playbook containing this role to set up MyBB in a Docker environment.
### Docker Compose Configuration ## Docker Compose Configuration
The `docker-compose.yml.j2` template outlines the services required for MyBB, including the application server, Nginx web server, and database (MariaDB). The `docker-compose.yml.j2` template outlines the services required for MyBB, including the application server, Nginx web server, and database (MariaDB).
### Additional Information ## Additional Information
- For detailed configuration and customization, refer to the contents of the `default.conf` template and the `docker-compose.yml.j2` template. - For detailed configuration and customization, refer to the contents of the `default.conf` template and the `docker-compose.yml.j2` template.
- Ensure that the environment variables and paths are correctly set as per your system's configuration. - Ensure that the environment variables and paths are correctly set as per your system's configuration.
### Created with ChatGPT ## Created with ChatGPT
This README was created with the assistance of ChatGPT, based on a conversation held at this [link](https://chat.openai.com/share/83828f9a-b817-48d8-86ed-599f64850b4d). ChatGPT provided guidance on structuring this document and outlining the key components of the Docker MyBB role. This README was created with the assistance of ChatGPT, based on a conversation held at this [link](https://chat.openai.com/share/83828f9a-b817-48d8-86ed-599f64850b4d). ChatGPT provided guidance on structuring this document and outlining the key components of the Docker MyBB role.
## More Information
- https://github.com/mybb/docker

View File

@ -4,7 +4,7 @@ upstream mybb {
server { server {
listen 80; listen 80;
error_log stderr debug;
root /var/www/html; root /var/www/html;
index index.html index.php; index index.html index.php;
@ -28,5 +28,17 @@ server {
include fastcgi_params; include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
# proxy timeouts
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;
# fastcgi timeouts
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
fastcgi_connect_timeout 300s;
} }
} }

View File

@ -1,7 +1,10 @@
version: '3.8'
services: services:
application: application:
logging: logging:
driver: journald driver: journald
options:
tag: "mybb_application"
image: mybb/mybb:latest image: mybb/mybb:latest
restart: always restart: always
links: links:
@ -11,6 +14,8 @@ services:
server: server:
logging: logging:
driver: journald driver: journald
options:
tag: "mybb_server"
links: links:
- application - application
image: nginx:mainline image: nginx:mainline
@ -23,20 +28,15 @@ services:
database: database:
logging: logging:
driver: journald driver: journald
image: mariadb options:
tag: "mybb_database"
environment: environment:
MYSQL_DATABASE: "mybb" POSTGRES_DB: mybb
MYSQL_USER: "mybb" POSTGRES_PASSWORD: "{{mybb_database_password}}"
MYSQL_PASSWORD: "{{mybb_database_password}}" POSTGRES_USER: mybb
MARIADB_ROOT_PASSWORD: "{{mybb_database_password}}" image: postgres:14-alpine
MARIADB_AUTO_UPGRADE: "1"
volumes: volumes:
- database:/var/lib/mysql - ${PWD}/postgres/data:/var/lib/postgresql/data:rw
healthcheck:
test: "/usr/bin/mariadb --user=mybb --password={{mybb_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
restart: always restart: always
volumes: volumes:
database: database: