Implemented postgress

This commit is contained in:
Kevin Veen-Birkenbach 2023-12-06 11:36:18 +01:00
parent 16d04d3c62
commit c43481f8e7
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.
## Role Name: Docker MyBB
### Dependencies
## Dependencies
- nginx-docker-reverse-proxy
### Variables
## Variables
- `docker_compose_instance_directory`: The directory where Docker Compose files for MyBB are stored.
- `conf_d_docker_directory`: Directory for Docker Nginx configuration.
- `default_conf_server_file`: The default Nginx configuration file for the server.
- `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.
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.
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.
### Usage
## Usage
#### Install Plugins
### Install Plugins
To install MyBB plugins, extract them to a mounted volume and sync using the provided `docker run` command
```bash
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.
### 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).
### 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.
- 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.
## More Information
- https://github.com/mybb/docker

View File

@ -4,7 +4,7 @@ upstream mybb {
server {
listen 80;
error_log stderr debug;
root /var/www/html;
index index.html index.php;
@ -28,5 +28,17 @@ server {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
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:
application:
logging:
driver: journald
options:
tag: "mybb_application"
image: mybb/mybb:latest
restart: always
links:
@ -11,6 +14,8 @@ services:
server:
logging:
driver: journald
options:
tag: "mybb_server"
links:
- application
image: nginx:mainline
@ -23,20 +28,15 @@ services:
database:
logging:
driver: journald
image: mariadb
options:
tag: "mybb_database"
environment:
MYSQL_DATABASE: "mybb"
MYSQL_USER: "mybb"
MYSQL_PASSWORD: "{{mybb_database_password}}"
MARIADB_ROOT_PASSWORD: "{{mybb_database_password}}"
MARIADB_AUTO_UPGRADE: "1"
POSTGRES_DB: mybb
POSTGRES_PASSWORD: "{{mybb_database_password}}"
POSTGRES_USER: mybb
image: postgres:14-alpine
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mariadb --user=mybb --password={{mybb_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
- ${PWD}/postgres/data:/var/lib/postgresql/data:rw
restart: always
volumes:
database: