Add containers

This commit is contained in:
David Petric 2023-03-27 20:54:28 +02:00
parent 04f275eb6e
commit a8345d0d45
7 changed files with 81 additions and 3 deletions

BIN
roles/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,5 +1,4 @@
--- ---
- name: PHP ini setup - name: PHP ini setup
copy: copy:
src: files/php{{ php_version }}.ini src: files/php{{ php_version }}.ini

View File

@ -0,0 +1,19 @@
version: '3'
services:
db:
container_name: mysql8
image: mysql:8.0
command: mysqld --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
ports:
- '127.0.0.1:3306:3306'
environment:
MYSQL_ROOT_PASSWORD: {{ mysql_root_pass }}
MYSQL_DATABASE: {{ mysql_db }}
MYSQL_USER: {{ mysql_user }}
MYSQL_PASSWORD: {{ mysql_user_pass }}
volumes:
- '/opt/docker/mysql:/var/lib/mysql'
mem_limit: {{ mysql_mem_limit }}M
mem_reservation: {{ mysql_mem_reserve }}M
restart: always

View File

@ -0,0 +1,12 @@
version: '3'
services:
cache:
container_name: redis
image: redis:6.2-alpine
restart: always
ports:
- '127.0.0.1:6379:6379'
command: redis-server --loglevel warning --requirepass {{ redis_pass }}
volumes:
- /opt/docker/redis:/data

View File

@ -0,0 +1,40 @@
---
- name: Create compose dir
file:
path: /opt/docker/compose-files
state: directory
mode: '0755'
- name: Create MySQL dirs
file:
path: /opt/docker/compose-files/mysql
state: directory
mode: '0755'
- name: Create MySQL dirs
file:
path: /opt/docker/mysql
state: directory
mode: '0755'
- name: Copy MySQL compose file
template:
src: files/mysql.j2
dest: /opt/docker/compose-files/mysql/docker-compose.yaml
- name: Create Redis dirs
file:
path: /opt/docker/compose-files/redis
state: directory
mode: '0755'
- name: Create Redisdirs
file:
path: /opt/docker/redis
state: directory
mode: '0755'
- name: Copy Redis compose file
template:
src: files/redis.j2
dest: /opt/docker/compose-files/redis/docker-compose.yml

View File

@ -12,4 +12,5 @@
- role: install-php - role: install-php
- role: configure-php - role: configure-php
- role: install-wordpress - role: install-wordpress
- role: install-docker - role: install-docker
- role: setup-containers

View File

@ -2,4 +2,11 @@
php_version: 8.1 php_version: 8.1
vhost_name: projectwp vhost_name: projectwp
domain: projectwp.com domain: projectwp.com
db_pwd: 123456 db_pwd: 123456
mysql_mem_limit: 1024
mysql_mem_reserve: 512
mysql_root_pass: xyz
mysql_db: projectwp
mysql_user: projectwp
mysql_user_pass: xyz
redis_pass: xyz