From 8d151e0836bb6e93e567db59601cdf06da7ac891 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 22 Feb 2023 20:24:11 -0500 Subject: [PATCH] More Docker Compose work --- .gitignore | 7 ++- README.md | 25 +++++++++++ conf/mariadb/password_reset.sql | 6 +++ docker-compose.yml | 75 ++++++++++++++++++--------------- srv/README.md | 38 +++++++++++++---- 5 files changed, 106 insertions(+), 45 deletions(-) create mode 100644 conf/mariadb/password_reset.sql diff --git a/.gitignore b/.gitignore index bd9b751..3d9a96f 100644 --- a/.gitignore +++ b/.gitignore @@ -80,6 +80,8 @@ logs/mailman2/ tmp/ temp/ +# OSIT and Aether specific: + # srv/aether_api/ # srv/aether_app/ # srv/hosted_files/ @@ -115,4 +117,7 @@ srv/hosted_files_ln srv/hosted_tmp_dev_ln/ srv/hosted_tmp_dev_ln srv/hosted_tmp_ln/ -srv/hosted_tmp_ln \ No newline at end of file +srv/hosted_tmp_ln + +srv/mariadb_ln/ +srv/mariadb_ln \ No newline at end of file diff --git a/README.md b/README.md index aa9fa18..28f2dc9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/conf/mariadb/password_reset.sql b/conf/mariadb/password_reset.sql new file mode 100644 index 0000000..2fe3653 --- /dev/null +++ b/conf/mariadb/password_reset.sql @@ -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; \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index da5fb19..54d911d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/srv/README.md b/srv/README.md index a6abb08..1f7703f 100644 --- a/srv/README.md +++ b/srv/README.md @@ -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 \ No newline at end of file +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/ +``` \ No newline at end of file