From 137f733fef9539d77d0f5a87cd41239697b4793a Mon Sep 17 00:00:00 2001 From: Yannic Kilcher Date: Tue, 17 Jan 2023 11:30:52 +0100 Subject: [PATCH] added oasst postgres --- ansible/deploy-to-node.yaml | 33 ++++++++------------------------- docker-compose.yaml | 3 ++- docker/Dockerfile.postgres | 2 +- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/ansible/deploy-to-node.yaml b/ansible/deploy-to-node.yaml index 4bb13bb6c4..bbadca6acd 100644 --- a/ansible/deploy-to-node.yaml +++ b/ansible/deploy-to-node.yaml @@ -57,8 +57,9 @@ - name: Create postgres containers community.docker.docker_container: name: "oasst-{{ stack_name }}-postgres-{{ item.name }}" - image: postgres:15 + image: ghcr.io/laion-ai/open-assistant/oasst-postgres state: started + pull: true recreate: "{{ (stack_name == 'dev') | bool }}" restart_policy: always network_mode: "oasst-{{ stack_name }}" @@ -66,6 +67,12 @@ POSTGRES_USER: postgres POSTGRES_PASSWORD: "{{ postgres_password }}" POSTGRES_DB: postgres + S3_BUCKET_NAME: + "{{ lookup('ansible.builtin.env', 'S3_BUCKET_NAME') }}" + AWS_ACCESS_KEY_ID: + "{{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY') }}" + AWS_SECRET_ACCESS_KEY: + "{{ lookup('ansible.builtin.env', 'AWS_SECRET_KEY') }}" volumes: - "oasst-{{ stack_name }}-postgres-{{ item.name }}:/var/lib/postgresql/data" @@ -78,30 +85,6 @@ - name: backend - name: web - - name: Copy pgbackrest.conf to managed node - ansible.builtin.copy: - src: ./pgbackrest.conf - dest: "./{{ stack_name }}/pgbackrest.conf" - mode: 0644 - - - name: Create pgbackrest container - community.docker.docker_container: - name: "oasst-{{ stack_name }}-pgbackrest" - image: woblerr/pgbackrest:2.43 - state: "{{ 'started' if stack_name == 'production' else 'absent' }}" - network_mode: "oasst-{{ stack_name }}" - entrypoint: ["/bin/bash", "-c", "sleep infinity"] - volumes: - - "./{{ stack_name }}/pgbackrest.conf:/etc/pgbackrest/pgbackrest.conf" - - "oasst-{{ stack_name }}-postgres-backend:/var/lib/postgresql/data" - env: - PGBACKREST_REPO1_S3_BUCKET: - "{{ lookup('ansible.builtin.env', 'S3_BUCKET_NAME') }}" - PGBACKREST_REPO1_S3_KEY: - "{{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY') }}" - PGBACKREST_REPO1_S3_KEY_SECRET: - "{{ lookup('ansible.builtin.env', 'AWS_SECRET_KEY') }}" - - name: Run the oasst oasst-backend community.docker.docker_container: name: "oasst-{{ stack_name }}-backend" diff --git a/docker-compose.yaml b/docker-compose.yaml index 78192eb385..908457cd8d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,7 +18,8 @@ services: # This DB is for the FastAPI Backend. db: - image: postgres + image: ghcr.io/laion-ai/open-assistant/oasst-postgres + pull_policy: always restart: always ports: - 5432:5432 diff --git a/docker/Dockerfile.postgres b/docker/Dockerfile.postgres index 0eb4fec0d7..b5b98c0756 100644 --- a/docker/Dockerfile.postgres +++ b/docker/Dockerfile.postgres @@ -1,4 +1,4 @@ -FROM postgres +FROM postgres:15 # install unzip RUN apt-get update && apt-get install -y unzip curl && rm -rf /var/lib/apt/lists/*