Last active
September 29, 2024 09:55
-
-
Save pokutuna/252c66ab599c0ba3e4bc137adb745a0b to your computer and use it in GitHub Desktop.
Label Studio & Litestream on Cloud Run | replace ******* to your setting
This file contains hidden or 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
steps: | |
- name: gcr.io/cloud-builders/docker | |
args: | |
- buildx | |
- build | |
- --tag=${_REGISTRY}/label-studio:latest | |
- . | |
- name: gcr.io/cloud-builders/docker | |
args: | |
- push | |
- --all-tags | |
- ${_REGISTRY}/label-studio | |
- name: asia.gcr.io/google.com/cloudsdktool/google-cloud-cli:slim | |
entrypoint: gcloud | |
args: | |
- run | |
- deploy | |
- labelstudio | |
- --image=${_REGISTRY}/label-studio:latest | |
- --region=asia-northeast1 | |
- --service-account=label-studio@******.iam.gserviceaccount.com | |
- --cpu=1 | |
- --memory=2Gi | |
- --cpu-boost | |
- --min-instances=0 | |
- --max-instances=1 | |
- --port=8080 | |
- --allow-unauthenticated | |
- --set-env-vars=LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK=true | |
substitutions: | |
_REGISTRY: asia-northeast1-docker.pkg.dev/******/d |
This file contains hidden or 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
# syntax=docker/dockerfile:1 | |
FROM heartexlabs/label-studio:latest | |
# https://github.com/HumanSignal/label-studio/blob/develop/Dockerfile | |
# Litestream | |
USER root | |
ENV LITESTREAM_VERSION=v0.3.13 | |
RUN ARCH=$(case $(uname -m) in x86_64) echo 'amd64';; aarch64) echo 'arm64';; *) echo 'unsupported' && exit 1;; esac) \ | |
&& curl -sL "https://github.com/benbjohnson/litestream/releases/download/${LITESTREAM_VERSION}/litestream-${LITESTREAM_VERSION}-linux-${ARCH}.deb" \ | |
--output /tmp/litestream.deb \ | |
&& dpkg -i /tmp/litestream.deb \ | |
&& rm /tmp/litestream.deb | |
COPY litestream.yaml /etc/litestream.yml | |
COPY startup.sh /startup.sh | |
RUN chmod +x /startup.sh | |
# label-studio user | |
USER 1001 | |
CMD ["/startup.sh"] |
This file contains hidden or 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
dbs: | |
- path: /label-studio/data/label_studio.sqlite3 | |
replicas: | |
- url: gcs://******/db/label_studio.sqlite3 | |
retention-check-interval: 10m | |
sync-interval: 10s | |
logging: | |
type: json |
This file contains hidden or 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
#!/bin/bash | |
DB_PATH=/label-studio/data/label_studio.sqlite3 | |
litestream restore -if-replica-exists -if-db-not-exists "$DB_PATH" | |
exec litestream replicate -exec label-studio |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment