More Docker Compose work

This commit is contained in:
Scott Idem
2023-02-22 20:24:11 -05:00
parent d0e6a6f921
commit 8d151e0836
5 changed files with 106 additions and 45 deletions

5
.gitignore vendored
View File

@@ -80,6 +80,8 @@ logs/mailman2/
tmp/
temp/
# OSIT and Aether specific:
# srv/aether_api/
# srv/aether_app/
# srv/hosted_files/
@@ -116,3 +118,6 @@ srv/hosted_tmp_dev_ln/
srv/hosted_tmp_dev_ln
srv/hosted_tmp_ln/
srv/hosted_tmp_ln
srv/mariadb_ln/
srv/mariadb_ln

View File

@@ -1,5 +1,30 @@
This can be used to create a Docker server cluster for the Aether App using Flask, Aether API using FastAPI.
## Initialize
### Part 1
```bash
sudo mkdir /srv/env
sudo chown -R scott:scott /srv/env/
git clone https://scott_idem@bitbucket.org/oneskyit/one-sky-it-container-environment.git /srv/env/test_aether
ln -s /srv/http/dev_app.oneskyit.com /srv/env/test_aether/srv/aether_app_ln
ln -s /srv/http/dev_fastapi.oneskyit.com /srv/env/test_aether/srv/aether_api_ln
ln -s /mnt/data/speaker_ready/hosted_tmp /srv/env/test_aether/srv/hosted_tmp_ln
ln -s /mnt/data/speaker_ready/hosted_files /srv/env/test_aether/srv/hosted_files_ln
ls -lha /srv/env/test_aether/srv/aether_app_ln/
ls -lha /srv/env/test_aether/srv/aether_api_ln/
ls -lha /srv/env/test_aether/srv/hosted_tmp_ln/
ls -lha /srv/env/test_aether/srv/hosted_files_ln/
````
### Part 2
```bash
sudo ls -lha /var/lib/mysql/
```
## Common:
* conf/ = All config files
* logs/ = All log files

View File

@@ -0,0 +1,6 @@
CREATE USER IF NOT EXISTS root@localhost IDENTIFIED BY '$1sky.Adapting.7e2';
SET PASSWORD FOR root@localhost = PASSWORD('$1sky.Adapting.7e2');
GRANT ALL ON *.* TO root@localhost WITH GRANT OPTION;
CREATE USER IF NOT EXISTS root@'%' IDENTIFIED BY '$1sky.Adapting.7e2';
SET PASSWORD FOR root@'%' = PASSWORD('$1sky.Adapting.7e2');
GRANT ALL ON *.* TO root@'%' WITH GRANT OPTION;

View File

@@ -47,7 +47,7 @@ services:
# - ./conf/nginx/site-enabled_aether_fastapi_2_gunicorn.conf:/etc/nginx/conf.d/site-enabled_aether_fastapi_2_gunicorn.conf
- ./conf/nginx/site-enabled_aether_flask_gunicorn.conf:/etc/nginx/conf.d/site-enabled_aether_flask_gunicorn.conf
- ./conf/certs/oneskyit.com_fullchain.pem:/etc/certs/fullchain.pem
- ./conf/certs/fullchain.pem:/etc/certs/fullchain.pem
- ./conf/certs/privkey.pem:/etc/certs/privkey.pem
- ./conf/certs/ssl-dhparams.pem:/etc/certs/ssl-dhparams.pem
@@ -144,41 +144,46 @@ services:
# networks:
# - local-net
# phpmyadmin:
# image: phpmyadmin
# container_name: ae_phpmyadmin
# restart: unless-stopped
# depends_on:
# - mariadb
# ports:
# - 8888:80
# env_file:
# - ./.env
# environment:
# - PMA_ARBITRARY=1
# - UPLOAD_LIMIT=1G
# mariadb:
# container_name: ae_mariadb_dev
# image: mariadb/server:latest
# restart: always
# # image: mariadb:10.6
# # env_file:
# # - ./.env
# # - filename.env
# ports:
# - "3307:3306"
# volumes:
# - ./srv/mariadb:/var/lib/mysql
# # - ./conf/mariadb/my.cnf:/etc/my.cnf
# environment:
# - MARIADB_ROOT_PASSWORD='MyPassword.1248'
# # - MARIADB_DATABASE: 'my_env_db'
# # - MYSQL_ROOT_PASSWORD=
# - MYSQL_PASSWORD=MyPassword
# - MYSQL_DATABASE=nextcloud
# - MYSQL_USER=nextcloud
phpmyadmin:
image: phpmyadmin
container_name: ae_phpmyadmin
restart: unless-stopped
depends_on:
- mariadb
ports:
- 8888:80
env_file:
- ./.env
environment:
- PMA_ARBITRARY=1
- UPLOAD_LIMIT=1G
mariadb:
container_name: ae_mariadb_dev
# image: mariadb/server:latest
image: mariadb:10.9
# image: mariadb:10.6
restart: always
# env_file:
# - ./.env
# - filename.env
ports:
- "3307:3306"
volumes:
- ./srv/mariadb:/var/lib/mysql
# - ./conf/mariadb/password_reset.sql:/docker-entrypoint-initdb.d/init.sql:ro
# - ./conf/mariadb/password_reset.sql:/password_reset.sql:z
# - ./srv/mariadb_ln:/var/lib/mysql
# - ./conf/mariadb/my.cnf:/etc/my.cnf
# environment:
# - MARIADB_ROOT_PASSWORD=$$1sky.Adapting.7e2
# - MARIADB_ROOT_PASSWORD=CentauriStar123
# - MARIADB_DATABASE: 'my_env_db'
# - MYSQL_ROOT_PASSWORD=$$1sky.Adapting.7e2
# - MYSQL_ROOT_PASSWORD=CentauriStar123
# - MYSQL_PASSWORD=MyPassword
# - MYSQL_DATABASE=nextcloud
# - MYSQL_USER=nextcloud
# nextcloud25:
# container_name: ae_nextcloud25_dev

View File

@@ -1,23 +1,43 @@
Create links to the actual file directories
./srv/aether_api
./srv/aether_app
./srv/hosted_files
./srv/mariadb
./srv/nextcloud
./srv/oneskyit_site
./srv/static_files
Create links to the actual directories as needed
* ./srv/aether_api
* ./srv/aether_app
* ./srv/hosted_files
* ./srv/mariadb
* ./srv/nextcloud
* ./srv/oneskyit_site
* ./srv/static_files
## Create links examples
### Flask App
```bash
ln -s /srv/http/dev_app.oneskyit.com /srv/env/test_aether/srv/aether_app_ln
ln -s ~/OSIT_dev/aether_app ~/OSIT_dev/aether_container_env/srv/aether_app_ln
```
### FastAPI API
```bash
ln -s /srv/http/dev_fastapi.oneskyit.com /srv/env/test_aether/srv/aether_api_ln
ln -s ~/OSIT_dev/aether_api_fastapi ~/OSIT_dev/aether_container_env/srv/aether_api_ln
```
### Hosted tmp files
```bash
ln -s /mnt/data/speaker_ready/hosted_tmp /srv/env/test_aether/srv/hosted_tmp_ln
ln -s /mnt/data_drive/srv/data/osit_app/hosted_tmp /home/scott/OSIT_dev/aether_container_env/srv/hosted_tmp_ln
ln -s /mnt/data_drive/srv/data/osit_app/hosted_tmp_dev /home/scott/OSIT_dev/aether_container_env/srv/hosted_tmp_ln
```
### Hosted (hashed) files
```bash
ln -s /mnt/data/speaker_ready/hosted_files /srv/env/test_aether/srv/hosted_files_ln
ln -s /mnt/data_drive/srv/data/osit_app/hosted_files /home/scott/OSIT_dev/aether_container_env/srv/hosted_files_ln
ln -s /mnt/data_drive/srv/data/osit_app/hosted_files_dev /home/scott/OSIT_dev/aether_container_env/srv/hosted_files_ln
```
### MariaDB
```bash
sudo rsync -vhr -progress /var/lib/mysql/ /srv/env/test_aether/srv/mariadb/
rsync -v /var/lib/mysql/ /srv/env/test_aether/srv/mariadb/
sudo chown -R scott:scott /srv/env/test_aether/srv/mariadb/
```