Merge branch 'main' into production

This commit is contained in:
Yannic Kilcher
2023-01-17 12:22:38 +01:00
3 changed files with 16 additions and 2 deletions
+1 -2
View File
@@ -73,8 +73,7 @@
"{{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY') }}"
AWS_SECRET_ACCESS_KEY:
"{{ lookup('ansible.builtin.env', 'AWS_SECRET_KEY') }}"
AWS_DEFAULT_REGION:
"{{ lookup('ansible.builtin.env', 'S3_REGION') }}"
AWS_DEFAULT_REGION: "{{ lookup('ansible.builtin.env', 'S3_REGION') }}"
volumes:
- "oasst-{{ stack_name }}-postgres-{{ item.name
}}:/var/lib/postgresql/data"
+2
View File
@@ -7,3 +7,5 @@ RUN apt-get update && apt-get install -y unzip curl && rm -rf /var/lib/apt/lists
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip -q awscliv2.zip
RUN ./aws/install
COPY ./backup_pg_to_s3.sh .
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
set -e
set -x
# filename with timestamp
filename="postgres-$(date +%Y-%m-%d_%H-%M-%S).sql"
# perform pg_dump
pg_dump -U postgres postgres > /tmp/$filename
# upload to s3
aws s3 cp /tmp/$filename s3://$S3_BUCKET_NAME/$filename