Chore: Move from remote database host to linked docker container

This commit is contained in:
Amritanshu Agrawal 2022-07-05 07:09:44 +05:30
parent 97767e0c11
commit a4c3ae1035
7 changed files with 16 additions and 9 deletions

View File

@ -32,5 +32,5 @@ else
echo "No version bump" echo "No version bump"
fi fi
cd "$parent_path/docker" || exit cd "$parent_path/docker" || exit
docker save brewman:latest | bzip2 | pv | ssh vancity 'bunzip2 | sudo docker load' docker save brewman:latest | bzip2 | pv | ssh beacon 'bunzip2 | sudo docker load'
ansible-playbook --inventory hosts playbook.yml ansible-playbook --inventory hosts playbook.yml

View File

@ -2,7 +2,7 @@ HOST=0.0.0.0
PORT=80 PORT=80
LOG_LEVEL=WARN LOG_LEVEL=WARN
DEBUG=false DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@172.26.5.85:5432/acc SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/acc
MODULE_NAME=brewman.main MODULE_NAME=brewman.main
PROJECT_NAME=brewman PROJECT_NAME=brewman
POSTGRES_SERVER=db POSTGRES_SERVER=db

View File

@ -2,7 +2,7 @@ HOST=0.0.0.0
PORT=80 PORT=80
LOG_LEVEL=WARN LOG_LEVEL=WARN
DEBUG=false DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@172.26.5.85:5432/exp SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/exp
MODULE_NAME=brewman.main MODULE_NAME=brewman.main
PROJECT_NAME=brewman PROJECT_NAME=brewman
POSTGRES_SERVER=db POSTGRES_SERVER=db

View File

@ -2,7 +2,7 @@ HOST=0.0.0.0
PORT=80 PORT=80
LOG_LEVEL=WARN LOG_LEVEL=WARN
DEBUG=false DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@172.26.5.85:5432/hops SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/hops
MODULE_NAME=brewman.main MODULE_NAME=brewman.main
PROJECT_NAME=brewman PROJECT_NAME=brewman
POSTGRES_SERVER=db POSTGRES_SERVER=db

View File

@ -2,7 +2,7 @@ HOST=0.0.0.0
PORT=80 PORT=80
LOG_LEVEL=WARN LOG_LEVEL=WARN
DEBUG=false DEBUG=false
SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@172.26.5.85:5432/mhl SQLALCHEMY_DATABASE_URI=postgresql://postgres:123456@db:5432/mhl
MODULE_NAME=brewman.main MODULE_NAME=brewman.main
PROJECT_NAME=brewman PROJECT_NAME=brewman
POSTGRES_SERVER=db POSTGRES_SERVER=db

View File

@ -5,10 +5,10 @@
# - A hostname/ip can be a member of multiple groups # - A hostname/ip can be a member of multiple groups
[brewman] [brewman]
acc ansible_host=vancity var_file=vars/acc.yml acc ansible_host=beacon var_file=vars/acc.yml
exp ansible_host=vancity var_file=vars/exp.yml exp ansible_host=beacon var_file=vars/exp.yml
hops ansible_host=vancity var_file=vars/hops.yml hops ansible_host=beacon var_file=vars/hops.yml
mhl ansible_host=vancity var_file=vars/mhl.yml mhl ansible_host=beacon var_file=vars/mhl.yml
[all:vars] [all:vars]
ansible_python_interpreter=/usr/bin/python3 ansible_python_interpreter=/usr/bin/python3

View File

@ -21,6 +21,11 @@
state: present state: present
source: build source: build
- name: Ensure Host Directory exists
file:
path: "/var/lib/{{ host_directory }}"
state: directory
- name: Upload the .env file - name: Upload the .env file
template: template:
src: "{{ env_file }}" src: "{{ env_file }}"
@ -33,6 +38,8 @@
state: started state: started
restart_policy: "unless-stopped" restart_policy: "unless-stopped"
env_file: "/var/lib/{{ host_directory }}/.env" env_file: "/var/lib/{{ host_directory }}/.env"
links:
- "postgres:db"
published_ports: published_ports:
- "127.0.0.1:{{ host_port }}:80" - "127.0.0.1:{{ host_port }}:80"
volumes: volumes: