Skip to content

Commit

Permalink
add infrastructure dir and adapt docker file locations
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed May 23, 2024
1 parent ee9a75d commit 3305224
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
conferences:
build:
context: .
dockerfile: src/docker/Dockerfile.conferences
dockerfile: infrastructure/docker/Dockerfile.conferences
command: uvicorn main:app --host 0.0.0.0 --reload # sleep 9999999999
depends_on:
- redis
Expand All @@ -27,7 +27,7 @@ services:
telegram:
build:
context: .
dockerfile: src/docker/Dockerfile.telegram
dockerfile: infrastructure/docker/Dockerfile.telegram

command: python workers/telegram.py # sleep 99999
depends_on:
Expand All @@ -44,7 +44,7 @@ services:
push_notifications:
build:
context: .
dockerfile: src/docker/Dockerfile.push_notifications
dockerfile: infrastructure/docker/Dockerfile.push_notifications

command: python workers/push_notifications.py # sleep 99999
depends_on:
Expand All @@ -64,4 +64,4 @@ services:
POSTGRES_PASSWORD: sfscon
hostname: postgres
volumes:
- /tmp/epaper_pgdata:/var/lib/postgresql/data
- /tmp/epaper_pgdata:/var/lib/postgresql/data
4 changes: 4 additions & 0 deletions infrastructure/ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[defaults]
inventory = ./hosts
roles_path = ./roles
retry_files_enabled = False
19 changes: 19 additions & 0 deletions infrastructure/ansible/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- hosts: all
vars:
ansible_python_interpreter: /usr/bin/python3
tasks:
- name: Login to GitHub Container Registry
ansible.builtin.shell:
cmd: echo "{{ docker_password }}" | docker login "{{ docker_host }}" --username "{{ docker_username }}" --password-stdin
- name: Execute Docker deployment
ansible.builtin.include_role:
name: ansible-docker-deployment
vars:
docker_deployment_project_name: '{{ project_name }}'
docker_deployment_release_name: '{{ release_name }}'
docker_deployment_release_files:
- local: ../docker-compose.run.yml
remote: docker-compose.yml
- local: ../../.env
remote: .env
5 changes: 5 additions & 0 deletions infrastructure/ansible/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[test]
docker03.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'

[prod]
docker03.opendatahub.bz.it ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'
2 changes: 2 additions & 0 deletions infrastructure/ansible/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- src: git+https://github.com/noi-techpark/ansible-docker-deployment.git
version: "2.0"
2 changes: 2 additions & 0 deletions infrastructure/ansible/roles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
25 changes: 25 additions & 0 deletions infrastructure/docker-compose.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
services:

conferences:
image: ${DOCKER_IMAGE_CONFERENCES}:${DOCKER_TAG}
env_file:
- ../.env
build:
context: ../
dockerfile: infrastructure/docker/Dockerfile.conferences

push_notifications:
image: ${DOCKER_IMAGE_PUSH_NOTIFICATIONS}:${DOCKER_TAG}
env_file:
- ../.env
build:
context: ../
dockerfile: infrastructure/docker/Dockerfile.push_notifications

telegram:
image: ${DOCKER_IMAGE_TELEGRAM}:${DOCKER_TAG}
env_file:
- ../.env
build:
context: ../
dockerfile: infrastructure/docker/Dockerfile.telegram
53 changes: 53 additions & 0 deletions infrastructure/docker-compose.run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
services:

conferences:
image: ${DOCKER_IMAGE_CONFERENCES}:${DOCKER_TAG}
command: uvicorn main:app --host 0.0.0.0 --reload # sleep 9999999999
env_file:
- ../.env
ports:
- "${SERVER_PORT_CONFERENCES}:8000"
volumes:
- opencon-logs:/var/log/opencon

push_notifications:
image: ${DOCKER_IMAGE_PUSH_NOTIFICATIONS}:${DOCKER_TAG}
command: python workers/push_notifications.py # sleep 99999
env_file:
- ../.env
ports:
- "${API_SERVER_PORT_PUSH_NOTIFICATIONS}:8080"
volumes:
- opencon-logs:/var/log/opencon

telegram:
image: ${DOCKER_IMAGE_TELEGRAM}:${DOCKER_TAG}
command: python workers/telegram.py # sleep 99999
env_file:
- ../.env
ports:
- "${API_SERVER_PORT_TELEGRAM}:8080"
volumes:
- opencon-logs:/var/log/opencon

postgres:
image: "postgres:14-alpine"
environment:
POSTGRES_DB: sfscon
POSTGRES_USER: sfscon
POSTGRES_PASSWORD: sfscon
hostname: postgres
volumes:
- postgres-data:/var/lib/postgresql/data

redis:
command: redis-server
hostname: redis
image: redis:alpine
labels:
NAME: redis

volumes:
opencon-logs:
postgres-data:

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3305224

Please sign in to comment.