mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-04 04:08:15 +00:00 
			
		
		
		
	Updated role
This commit is contained in:
		@@ -1,7 +1,42 @@
 | 
				
			|||||||
# role mybb
 | 
					# Docker MyBB Role
 | 
				
			||||||
## install plugins
 | 
					
 | 
				
			||||||
Extract the plugins to /mnt.
 | 
					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.
 | 
				
			||||||
Execute:
 | 
					
 | 
				
			||||||
 | 
					## Role Name: Docker MyBB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Dependencies
 | 
				
			||||||
 | 
					- nginx-docker-reverse-proxy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 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
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Install Plugins 
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					Execute the Ansible playbook containing this role to set up MyBB in a Docker environment.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 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
 | 
				
			||||||
 | 
					- 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
 | 
				
			||||||
 | 
					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.
 | 
				
			||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
- name: recreate mybb
 | 
					- name: recreate mybb
 | 
				
			||||||
  command:
 | 
					  command:
 | 
				
			||||||
    cmd: docker-compose -p mybb up -d --force-recreate
 | 
					    cmd: docker-compose -p mybb up -d --force-recreate
 | 
				
			||||||
    chdir: "{{path_docker_compose_files}}mybb/"
 | 
					    chdir: "{{docker_compose_instance_directory}}"
 | 
				
			||||||
  environment:
 | 
					  environment:
 | 
				
			||||||
    COMPOSE_HTTP_TIMEOUT: 600
 | 
					    COMPOSE_HTTP_TIMEOUT: 600
 | 
				
			||||||
    DOCKER_CLIENT_TIMEOUT: 600
 | 
					    DOCKER_CLIENT_TIMEOUT: 600
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,20 +3,26 @@
 | 
				
			|||||||
  command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
 | 
					  command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: configure {{domain}}.conf
 | 
					- name: configure {{domain}}.conf
 | 
				
			||||||
  template: src=roles/nginx-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
 | 
					  template: 
 | 
				
			||||||
 | 
					    src:  "roles/nginx-docker-reverse-proxy/templates/domain.conf.j2" 
 | 
				
			||||||
 | 
					    dest: "/etc/nginx/conf.d/{{domain}}.conf"
 | 
				
			||||||
  notify: restart nginx
 | 
					  notify: restart nginx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: create data folder
 | 
					- name: "create {{conf_d_docker_directory}} and parent directories"
 | 
				
			||||||
  file:
 | 
					  file:
 | 
				
			||||||
    path: "{{conf_d_docker_path}}"
 | 
					    path: "{{conf_d_docker_directory}}"
 | 
				
			||||||
    state: directory
 | 
					    state: directory
 | 
				
			||||||
    mode: 0755
 | 
					    mode: 0755
 | 
				
			||||||
 | 
					    recurse: yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: "create {{default_conf_docker_path}}"
 | 
					- name: "create {{default_conf_server_file}}"
 | 
				
			||||||
  template: src="default.conf" dest="{{default_conf_docker_path}}"
 | 
					  template: 
 | 
				
			||||||
 | 
					    src:  "default.conf"
 | 
				
			||||||
 | 
					    dest: "{{default_conf_server_file}}"
 | 
				
			||||||
 | 
					  notify: recreate mybb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: add docker-compose.yml
 | 
					- name: add docker-compose.yml
 | 
				
			||||||
  template: 
 | 
					  template: 
 | 
				
			||||||
    src:  "docker-compose.yml.j2" 
 | 
					    src:  "docker-compose.yml.j2" 
 | 
				
			||||||
    dest: "{{docker_compose_instance_directory}}docker-compose.yml"
 | 
					    dest: "{{docker_compose_instance_directory}}docker-compose.yml"
 | 
				
			||||||
  notify: recreate matomo
 | 
					  notify: recreate mybb
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,16 @@
 | 
				
			|||||||
services:
 | 
					services:
 | 
				
			||||||
  application:
 | 
					  application:
 | 
				
			||||||
    log_driver: journald
 | 
					    logging:
 | 
				
			||||||
 | 
					      driver: journald
 | 
				
			||||||
    image: mybb/mybb:latest
 | 
					    image: mybb/mybb:latest
 | 
				
			||||||
    restart: always
 | 
					    restart: always
 | 
				
			||||||
    links:
 | 
					    links:
 | 
				
			||||||
      - database
 | 
					      - database
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - mybb-data:/var/www/html
 | 
					      - data:/var/www/html
 | 
				
			||||||
  server:
 | 
					  server:
 | 
				
			||||||
    log_driver: journald
 | 
					    logging:
 | 
				
			||||||
 | 
					      driver: journald
 | 
				
			||||||
    links:
 | 
					    links:
 | 
				
			||||||
      - application
 | 
					      - application
 | 
				
			||||||
    image: nginx:mainline
 | 
					    image: nginx:mainline
 | 
				
			||||||
@@ -16,15 +18,17 @@ services:
 | 
				
			|||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "127.0.0.1:{{http_port}}:80"
 | 
					      - "127.0.0.1:{{http_port}}:80"
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
    - "{{conf_d_docker_path}}:{{conf_d_path}}"
 | 
					    - "{{conf_d_server_directory}}:{{conf_d_docker_directory}}:ro"
 | 
				
			||||||
    - "mybb-data:/var/www/html:ro"
 | 
					    - "data:/var/www/html:ro"
 | 
				
			||||||
  database:
 | 
					  database:
 | 
				
			||||||
    log_driver: journald
 | 
					    logging:
 | 
				
			||||||
 | 
					      driver: journald
 | 
				
			||||||
    image: mariadb
 | 
					    image: mariadb
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      MYSQL_DATABASE: "mybb"
 | 
					      MYSQL_DATABASE: "mybb"
 | 
				
			||||||
      MYSQL_USER: "mybb"
 | 
					      MYSQL_USER: "mybb"
 | 
				
			||||||
      MYSQL_PASSWORD: "{{mybb_database_password}}"
 | 
					      MYSQL_PASSWORD: "{{mybb_database_password}}"
 | 
				
			||||||
 | 
					      MARIADB_ROOT_PASSWORD: "{{mybb_database_password}}"
 | 
				
			||||||
      MARIADB_AUTO_UPGRADE: "1"
 | 
					      MARIADB_AUTO_UPGRADE: "1"
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - database:/var/lib/mysql
 | 
					      - database:/var/lib/mysql
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
docker_compose_instance_directory: "{{path_docker_compose_files}}mybb/"
 | 
					docker_compose_instance_directory: "{{path_docker_compose_files}}mybb/"
 | 
				
			||||||
conf_d_path: "/etc/nginx/conf.d/"
 | 
					conf_d_server_directory: "{{docker_compose_instance_directory}}conf.d/"
 | 
				
			||||||
conf_d_docker_path: "/etc/docker/applications/mybb{{conf_d_path}}"
 | 
					default_conf_server_file: "{{conf_d_docker_directory}}default.conf"
 | 
				
			||||||
default_conf_docker_path: "{{conf_d_docker_path}}default.conf"
 | 
					conf_d_docker_directory: "/etc/nginx/conf.d/"
 | 
				
			||||||
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user