Skip to content

Commit

Permalink
added oasst postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
yk committed Jan 17, 2023
1 parent 4285438 commit 137f733
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
33 changes: 8 additions & 25 deletions ansible/deploy-to-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,22 @@
- 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 }}"
env:
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"
Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.postgres
Original file line number Diff line number Diff line change
@@ -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/*
Expand Down

0 comments on commit 137f733

Please sign in to comment.