From af9f11fbde332dfebb8c79e52f009cfd13d08346 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Mon, 24 Apr 2023 16:27:34 -0700 Subject: [PATCH] 'bsky' (appview) dev helpers (#888) * remove commited .env files; exclude in gitignore * bsky: distinct postgresql database in dev mode * github CI: build and upload 'bsky' container to GHCR This isn't how we deploy, but is useful for public access and things like integration tests. * Makefile: run-dev-appview --- .../workflows/build-and-push-bsky-ghcr.yaml | 55 +++++++++++++++++++ .gitignore | 3 +- Makefile | 5 ++ packages/bsky/.env | 1 - packages/bsky/example.dev.env | 2 +- packages/pds/.env | 2 - 6 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build-and-push-bsky-ghcr.yaml delete mode 100644 packages/bsky/.env delete mode 100644 packages/pds/.env diff --git a/.github/workflows/build-and-push-bsky-ghcr.yaml b/.github/workflows/build-and-push-bsky-ghcr.yaml new file mode 100644 index 00000000000..4163846740f --- /dev/null +++ b/.github/workflows/build-and-push-bsky-ghcr.yaml @@ -0,0 +1,55 @@ +name: build-and-push-bsky-ghcr +on: + push: + branches: + - main +env: + REGISTRY: ghcr.io + USERNAME: ${{ github.actor }} + PASSWORD: ${{ secrets.GITHUB_TOKEN }} + + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + bsky-container-ghcr: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v1 + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.USERNAME }} + password: ${{ env.PASSWORD }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha,enable=true,priority=100,prefix=bsky:,suffix=,format=long + + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + file: ./packages/bsky/Dockerfile + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.gitignore b/.gitignore index 0708338cab8..3648e5a3f73 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,8 @@ test.sqlite .DS_Store *.log tsconfig.build.tsbuildinfo -.dev.env +.*.env +.env \#*\# *~ *.swp diff --git a/Makefile b/Makefile index 8153f87b288..0f6bccc1eb1 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,11 @@ run-dev-pds: ## Run PDS locally if [ ! -f "packages/pds/.dev.env" ]; then cp packages/pds/example.dev.env packages/pds/.dev.env; fi cd packages/pds; ENV=dev yarn run start | yarn exec pino-pretty +.PHONY: run-dev-bsky +run-dev-bsky: ## Run appview ('bsky') locally + if [ ! -f "packages/bsky/.dev.env" ]; then cp packages/bsky/example.dev.env packages/bsky/.dev.env; fi + cd packages/bsky; ENV=dev yarn run start | yarn exec pino-pretty + .PHONY: lint lint: ## Run style checks and verify syntax yarn verify diff --git a/packages/bsky/.env b/packages/bsky/.env deleted file mode 100644 index df97ddc605f..00000000000 --- a/packages/bsky/.env +++ /dev/null @@ -1 +0,0 @@ -DEBUG_MODE="1" diff --git a/packages/bsky/example.dev.env b/packages/bsky/example.dev.env index 3d25d464c1e..021790c9731 100644 --- a/packages/bsky/example.dev.env +++ b/packages/bsky/example.dev.env @@ -1,4 +1,4 @@ -DB_POSTGRES_URL="postgres://bsky:yksb@localhost/pds_dev" +DB_POSTGRES_URL="postgres://bsky:yksb@localhost/bsky_dev" DEBUG_MODE=1 LOG_ENABLED="true" LOG_LEVEL=debug diff --git a/packages/pds/.env b/packages/pds/.env deleted file mode 100644 index 0d4fdb074b4..00000000000 --- a/packages/pds/.env +++ /dev/null @@ -1,2 +0,0 @@ -DATABASE_LOC="" -DEBUG_MODE="1" \ No newline at end of file