postgres integration complete thru woodpecker pipeline
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -50,37 +50,6 @@
|
||||
- name: Reset ssh connection to allow the user/group change to take effect
|
||||
ansible.builtin.meta: reset_connection
|
||||
|
||||
- name: Build container image locally
|
||||
community.docker.docker_image:
|
||||
name: gamearray
|
||||
source: build
|
||||
state: present
|
||||
build:
|
||||
path: /mnt/d/cosmovault/latticework/oreilly/percival/python-tdd
|
||||
platform: linux/amd64
|
||||
force_source: true
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: Export container image locally
|
||||
community.docker.docker_image:
|
||||
name: gamearray
|
||||
archive_path: /tmp/gamearray-img.tar
|
||||
source: local
|
||||
delegate_to: 127.0.0.1
|
||||
|
||||
- name: Upload image to server
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/gamearray-img.tar
|
||||
dest: /tmp/gamearray-img.tar
|
||||
|
||||
- name: Import container image on server
|
||||
community.docker.docker_image:
|
||||
name: gamearray
|
||||
load_path: /tmp/gamearray-img.tar
|
||||
source: load
|
||||
force_source: true
|
||||
state: present
|
||||
|
||||
- name: Ensure .secret-key files exists
|
||||
# the intention is that this only happens once per server
|
||||
ansible.builtin.copy:
|
||||
@@ -120,27 +89,47 @@
|
||||
cmd: docker login gitea.earthmanrpg.me -u discoman -p {{ gitea_registry_token }}
|
||||
no_log: true
|
||||
|
||||
- name: Ensure db.sqlite3 file exists outside container
|
||||
ansible.builtin.file:
|
||||
path: "{{ ansible_env.HOME }}/db.sqlite3"
|
||||
state: touch
|
||||
owner: 1234 # so nonroot user can access it in container
|
||||
become: true # needed for ownership change
|
||||
- name: Create Docker network
|
||||
community.docker.docker_network:
|
||||
name: gamearray_net
|
||||
state: present
|
||||
|
||||
- name: Create Postgres data volume
|
||||
community.docker.docker_volume:
|
||||
name: gamearray_postgres_data
|
||||
state: present
|
||||
|
||||
- name: Start Postgres container
|
||||
community.docker.docker_container:
|
||||
name: gamearray_postgres
|
||||
image: postgres:16
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
networks:
|
||||
- name: gamearray_net
|
||||
volumes:
|
||||
- gamearray_postgres_data:/var/lib/postgresql/data
|
||||
env:
|
||||
POSTGRES_DB: gamearray
|
||||
POSTGRES_USER: gamearray
|
||||
POSTGRES_PASSWORD: "{{ postgres_password }}"
|
||||
|
||||
- name: Run container
|
||||
community.docker.docker_container:
|
||||
name: gamearray
|
||||
image: gamearray
|
||||
image: gitea.earthmanrpg.me/discoman/gamearray:latest
|
||||
state: started
|
||||
recreate: true
|
||||
env:
|
||||
DJANGO_DEBUG_FALSE: "1"
|
||||
DJANGO_SECRET_KEY: "{{ secret_key.content | b64decode }}"
|
||||
DJANGO_ALLOWED_HOST: "{{ django_allowed_host }}"
|
||||
DJANGO_DB_PATH: "/home/nonroot/db.sqlite3"
|
||||
DATABASE_URL: "postgresql://gamearray:{{ postgres_password }}@gamearray_postgres/gamearray"
|
||||
EMAIL_HOST_USER: "{{ email_host_user }}"
|
||||
EMAIL_HOST_PASSWORD: "{{ email_host_password }}"
|
||||
MAILGUN_API_KEY: "{{ mailgun_api_key }}"
|
||||
networks:
|
||||
- name: gamearray_net
|
||||
ports:
|
||||
127.0.0.1:8888:8888
|
||||
|
||||
@@ -160,7 +149,7 @@
|
||||
- name: Run migration inside container
|
||||
community.docker.docker_container_exec:
|
||||
container: gamearray
|
||||
command: ./manage.py migrate
|
||||
command: python manage.py migrate
|
||||
|
||||
handlers:
|
||||
- name: Restart nginx
|
||||
|
||||
Reference in New Issue
Block a user