This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from ar-io/litestream
chore(litestream): add docker builds for litestream
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Litestream | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'litestream/**' | ||
jobs: | ||
push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
checks: write | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# Build and push container image to GCR (only on main branch) | ||
- name: Log in to the GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push container image to GitHub Container Registry | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
context: litestream | ||
tags: | | ||
ghcr.io/ar-io/arns-litestream:latest | ||
ghcr.io/ar-io/arns-litestream:${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Start with a standard Ubuntu base image | ||
FROM ubuntu:20.04 as builder | ||
|
||
# Install curl and other necessary tools | ||
RUN apt-get update && apt-get install -y curl | ||
|
||
# Download and install ytt | ||
RUN curl -L https://github.com/vmware-tanzu/carvel-ytt/releases/download/v0.44.1/ytt-linux-amd64 > /usr/local/bin/ytt \ | ||
&& chmod 755 /usr/local/bin/ytt | ||
|
||
FROM litestream/litestream:latest | ||
|
||
COPY --from=builder /usr/local/bin/ytt /usr/local/bin/ytt | ||
|
||
COPY litestream.template.yaml . | ||
COPY docker-entrypoint.sh . | ||
|
||
RUN chmod 755 /docker-entrypoint.sh | ||
|
||
ENTRYPOINT [ "./docker-entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env sh | ||
set -e | ||
|
||
# Update env vars | ||
ytt --data-values-env TVAL -f /litestream.template.yaml > /litestream.yml | ||
|
||
/usr/local/bin/litestream replicate -config /litestream.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#@ load("@ytt:data", "data") | ||
|
||
dbs: | ||
- path: #@ data.values.LOCAL_DB_PATH + "/state.db" | ||
replicas: | ||
- url: #@ data.values.S3_BUCKET_PATH | ||
- path: #@ data.values.LOCAL_DB_PATH + "/contract.db" | ||
replicas: | ||
- url: #@ data.values.S3_BUCKET_PATH |