Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker images for database backups #2

Merged
merged 8 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and release images

on: push

concurrency: build-${{ github.sha }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create SHA tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "tag=$tag" >> $GITHUB_OUTPUT

- name: Build images
run: |
docker build ./images/postgresql-s3-backup/ -t ghcr.io/quiltmc/postgresql-s3-backup:latest
docker tag ghcr.io/quiltmc/postgresql-s3-backup:latest ghcr.io/quiltmc/postgresql-s3-backup:${{ steps.sha_tag.outputs.tag }}
docker build ./images/mongodb-s3-backup/ -t ghcr.io/quiltmc/mongodb-s3-backup:latest
docker tag ghcr.io/quiltmc/mongodb-s3-backup:latest ghcr.io/quiltmc/mongodb-s3-backup:${{ steps.sha_tag.outputs.tag }}

- name: Login to Github Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push images to the registry
if: github.ref == 'refs/heads/main'
run: |
docker push ghcr.io/quiltmc/postgresql-s3-backup:latest
docker push ghcr.io/quiltmc/postgresql-s3-backup:${{ steps.sha_tag.outputs.tag }}
docker push ghcr.io/quiltmc/mongodb-s3-backup:latest
docker push ghcr.io/quiltmc/mongodb-s3-backup:${{ steps.sha_tag.outputs.tag }}
6 changes: 3 additions & 3 deletions charts/cozy/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dependencies:
version: 13.16.2
- name: s3-backups
repository: file://../s3-backups
version: 0.1.2
digest: sha256:35e069526f02c4c034838e6a6fb7728d2416c747d197563c8870861bb02d605e
generated: "2023-11-08T13:41:36.999090206-05:00"
version: 0.2.0
digest: sha256:ed55f38f351d0d9cd5a4485e23bd71277408eb0f2362f1cc4ed6d8e49c90384f
generated: "2024-05-12T02:48:54.590979+02:00"
4 changes: 2 additions & 2 deletions charts/cozy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: quilt-cozy
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.2
version: 1.1.3
# This is the version number of the application being deployed (purely informational).
appVersion: '1'
description: helm chart to deploy the Quilt Cozy Discord bot
Expand All @@ -21,5 +21,5 @@ dependencies:
version: 13.16.2
repository: https://charts.bitnami.com/bitnami
- name: s3-backups
version: 0.1.2
version: 0.2.0
repository: 'file://../s3-backups'
3 changes: 2 additions & 1 deletion charts/cozy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ messageLogs: '839495849116958780,839496251463958548'
releaseChannels: '832351145073573889,832351173640978472'
statusChannel: '1009020306280681532'

resources: # cf. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
# cf. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 400m
memory: 924Mi
Expand Down
6 changes: 3 additions & 3 deletions charts/forum/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies:
version: 17.17.1
- name: s3-backups
repository: file://../s3-backups
version: 0.1.2
digest: sha256:bd21a581ec07cbb25dc97fce1a753e344c15cc31bb16161bc43bdc34d3924aa3
generated: "2023-11-08T13:46:26.300506947-05:00"
version: 0.2.0
digest: sha256:6ad85e467301603ce3782e8e81f68932fc399302bc4aa5dad9dea8836cf92ee4
generated: "2024-05-12T02:49:15.499456+02:00"
4 changes: 2 additions & 2 deletions charts/forum/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: quilt-forum
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.0
version: 0.2.1
# This is the version number of the Discourse image being deployed (purely informational).
appVersion: '3.2.1'
description: helm chart to deploy the Quilt Discourse Forum
Expand All @@ -27,5 +27,5 @@ dependencies:
repository: https://charts.bitnami.com/bitnami
version: 17.X.X
- name: s3-backups
version: 0.1.2
version: 0.2.0
repository: 'file://../s3-backups'
6 changes: 3 additions & 3 deletions charts/modmail/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dependencies:
version: 13.16.2
- name: s3-backups
repository: file://../s3-backups
version: 0.1.2
digest: sha256:35e069526f02c4c034838e6a6fb7728d2416c747d197563c8870861bb02d605e
generated: "2023-11-08T13:43:55.611759705-05:00"
version: 0.2.0
digest: sha256:ed55f38f351d0d9cd5a4485e23bd71277408eb0f2362f1cc4ed6d8e49c90384f
generated: "2024-05-12T02:51:30.626063+02:00"
4 changes: 2 additions & 2 deletions charts/modmail/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: quilt-modmail
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.2
version: 1.1.3
# This is the version number of the application being deployed (purely informational).
appVersion: '1'
description: helm chart to deploy Quilt's Modmail Discord bot
Expand All @@ -21,5 +21,5 @@ dependencies:
version: 13.16.2
repository: https://charts.bitnami.com/bitnami
- name: s3-backups
version: 0.1.2
version: 0.2.0
repository: 'file://../s3-backups'
5 changes: 3 additions & 2 deletions charts/modmail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ viewer:
port: 80
oauthClientId: '836548129763098674'

resources: # cf. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
# cf. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 400m
memory: 924Mi
Expand All @@ -33,4 +34,4 @@ mongodb:

s3-backups:
database:
password: modmail
password: modmail
6 changes: 6 additions & 0 deletions charts/s3-backups/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: 13.16.2
digest: sha256:17d8573ce48684adf09ea3684534a85acab1fcbf101d041cdacc65cf87f6c8d3
generated: "2024-05-12T02:51:37.002346+02:00"
2 changes: 1 addition & 1 deletion charts/s3-backups/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: s3-backups
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.2
version: 0.2.0
# This is the version number of the application being deployed (purely informational).
appVersion: '1'
description: helm chart handling Quilt's backups to an S3
Expand Down
4 changes: 2 additions & 2 deletions charts/s3-backups/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ spec:
containers:
- name: backup
{{- if eq .Values.database.type "mongodb" }}
image: ghcr.io/bitofsky/mongodb-awscli-image:v0.0.1
image: ghcr.io/quiltmc/mongodb-s3-backup:latest
{{- else if eq .Values.database.type "postgresql" }}
image: osodevops/aws-cli-postgres
image: ghcr.io/quiltmc/postgresql-s3-backup:latest
{{- end }}
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-c"]
Expand Down
6 changes: 3 additions & 3 deletions charts/stats/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dependencies:
version: 12.8.0
- name: s3-backups
repository: file://../s3-backups
version: 0.1.2
digest: sha256:822e55f861924ff561d776eacdd1af188b0d92e1e66cd0e70a6a7142295239d9
generated: "2023-11-08T13:44:38.542968618-05:00"
version: 0.2.0
digest: sha256:48d01dbddab226ed5d1e4166fab44ee771ffbb781cdb5c447d35d67b1901526e
generated: "2024-05-12T02:51:42.396378+02:00"
4 changes: 2 additions & 2 deletions charts/stats/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: quilt-stats
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.2
version: 1.1.3
# This is the version number of the application being deployed (purely informational).
appVersion: '1'
description: helm chart to deploy Quilt's Stats Discord bot
Expand All @@ -21,5 +21,5 @@ dependencies:
version: 12.8.0
repository: https://charts.bitnami.com/bitnami
- name: s3-backups
version: 0.1.2
version: 0.2.0
repository: 'file://../s3-backups'
3 changes: 2 additions & 1 deletion charts/stats/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ metabase:
url: stats.quiltmc.org
port: 3000

resources: # cf. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
# cf. https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 400m
memory: 924Mi
Expand Down
19 changes: 19 additions & 0 deletions images/mongodb-s3-backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:22.04

WORKDIR /dump

RUN apt update \
&& ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
&& apt-get install -y tzdata gnupg wget curl unzip \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& wget -qO- https://www.mongodb.org/static/pgp/server-7.0.asc | tee /etc/apt/trusted.gpg.d/server-7.0.asc \
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list \
&& apt update \
&& apt-get install -y mongodb-mongosh \
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf awscliv2.zip aws \
&& aws --version

CMD ["bash"]
15 changes: 15 additions & 0 deletions images/postgresql-s3-backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:22.04

WORKDIR /dump

RUN apt update \
&& ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
&& apt-get install -y tzdata postgresql-client curl unzip \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf awscliv2.zip aws \
&& aws --version

CMD ["bash"]
Loading