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: uptime-kuma and workflow files #1

Merged
merged 33 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
642ea11
add: uptime-kuma and workflow files
gustavovalverde Jun 28, 2024
814ee1f
fix(deploy): remove extra files
gustavovalverde Jun 28, 2024
25d494e
fix(deployment): move `Dockerfile` to right location
gustavovalverde Jun 28, 2024
8a90602
fix(build): use correct parameters
gustavovalverde Jun 28, 2024
81e89fc
fix(deploy): use correct execution values
gustavovalverde Jun 28, 2024
ddb83fe
fix(deploy): do not use a litestream config
gustavovalverde Jun 28, 2024
bb0666c
fix(deploy): allow deploying to cloud run without mounting volumes
gustavovalverde Jun 28, 2024
e46d6da
fix(pipeline): deploy with correct triggers
gustavovalverde Jun 28, 2024
3d1ff6f
fix(pipeline): deploy with correct triggers
gustavovalverde Jun 28, 2024
74957ac
fix(build): `/etc/litestream.yml` is required
gustavovalverde Jun 28, 2024
8f92818
fix(deploy): fix db state and bucket sync
gustavovalverde Jun 28, 2024
c433d58
imp: use latest uptime kuma for better DB management
gustavovalverde Jul 10, 2024
1c13af4
fix(build): do not change inherited service folders/services
gustavovalverde Jul 11, 2024
ccf4bbb
ref(deploy): allow an external `mariadb` database
gustavovalverde Jul 11, 2024
20a9f83
fix(db): allow bigger dns results
gustavovalverde Jul 11, 2024
4569b34
fix(startup): use correct logic
gustavovalverde Jul 11, 2024
6afbc5e
chore: linting
gustavovalverde Jul 11, 2024
83d8756
fix(startup): wrong condition
gustavovalverde Jul 11, 2024
d36f654
fix(db): patch `knex_init_db.js` file
gustavovalverde Jul 11, 2024
15e9497
fix(runtime): avoid spawning zombie processes
gustavovalverde Jul 14, 2024
700fbc1
chore: do not commit `trunk` linting confs
gustavovalverde Jul 14, 2024
c8c8908
fix(ci): allow instance deletion on merge
gustavovalverde Jul 14, 2024
1f2a408
chore: update all github actions
gustavovalverde Jul 14, 2024
944d9a0
imp(dependabot): group actions update
gustavovalverde Jul 14, 2024
bc29d0d
fix(actions): permissions
gustavovalverde Jul 14, 2024
c74a9b0
chore: put permissions above jobs
gustavovalverde Jul 14, 2024
ad23cf8
fix(actions): permissions
gustavovalverde Jul 14, 2024
c1d21c9
fix(actions): permissions
gustavovalverde Jul 14, 2024
a0877f6
fix(deploy): use correct principalSet instead of SA
gustavovalverde Jul 15, 2024
2d7b8b5
fix(build): docker login requires a SA
gustavovalverde Jul 15, 2024
4263b42
fix(deploy): attach the CloudSQL instance
gustavovalverde Jul 15, 2024
2f0db5d
chore: organize flags
gustavovalverde Jul 15, 2024
69c0fa4
imp(deploy): use secrets from GCP secret manager
gustavovalverde Jul 15, 2024
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
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: docker
directory: /
schedule:
interval: monthly
commit-message:
prefix: "deps(docker) "

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
commit-message:
prefix: "deps(actions) "
groups:
devops:
patterns:
- "*"
61 changes: 61 additions & 0 deletions .github/workflows/cd-deploy-to-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy to dev

on:
pull_request:
types: [opened, synchronize, reopened, labeled]
paths:
- '**/Dockerfile'
- 'scripts/**'
- 'etc/litestream.yml'
- .github/workflows/cd-deploy-to-dev.yml
- .github/workflows/sub-cloudrun-deploy.yml

concurrency:
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
actions: read
attestations: read
checks: read
contents: read
deployments: read
id-token: write
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read

jobs:
build:
uses: ./.github/workflows/sub-build-docker-image.yml
with:
environment: dev
dockerfile_path: ./docker/Dockerfile
dockerfile_target: runner
app_name: ${{ vars.APP_NAME }}
registry: ${{ vars.GAR_BASE }}
secrets: inherit

deploy:
needs: [build]
uses: ./.github/workflows/sub-cloudrun-deploy.yml
with:
environment: dev
project_id: ${{ vars.GCP_PROJECT }}
region: ${{ vars.GCP_REGION }}
app_name: ${{ vars.APP_NAME }}
registry: ${{ vars.GAR_BASE }}
image_digest: ${{ needs.build.outputs.image_digest }}
min_instances: '0'
max_instances: '30'
cpu: '1'
memory: 1Gi
secrets: inherit
57 changes: 57 additions & 0 deletions .github/workflows/cd-deploy-to-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Deploy to prod

on:
release:
types:
- published

concurrency:
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
actions: read
attestations: read
checks: read
contents: read
deployments: read
id-token: write
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read

jobs:
build:
# needs: [test]
uses: ./.github/workflows/sub-build-docker-image.yml
with:
environment: prod
dockerfile_path: ./docker/Dockerfile
dockerfile_target: runner
app_name: ${{ vars.APP_NAME }}
registry: ${{ vars.GAR_BASE }}
secrets: inherit

deploy:
needs: [build]
uses: ./.github/workflows/sub-cloudrun-deploy.yml
with:
environment: prod
project_id: ${{ vars.GCP_PROJECT }}
region: ${{ vars.GCP_REGION }}
app_name: ${{ vars.APP_NAME }}
registry: ${{ vars.GAR_BASE }}
image_digest: ${{ needs.build.outputs.image_digest }}
min_instances: '1'
max_instances: '10'
cpu: '1'
memory: 1Gi
secrets: inherit
62 changes: 62 additions & 0 deletions .github/workflows/cd-deploy-to-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Deploy to test

on:
push:
branches:
- main
paths:
- '**/Dockerfile'
- 'scripts/**'
- 'etc/litestream.yml'
- .github/workflows/cd-deploy-to-test.yml
- .github/workflows/sub-cloudrun-deploy.yml

concurrency:
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
actions: read
attestations: read
checks: read
contents: read
deployments: read
id-token: write
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read

jobs:
build:
uses: ./.github/workflows/sub-build-docker-image.yml
with:
environment: test
dockerfile_path: ./docker/Dockerfile
dockerfile_target: runner
app_name: ${{ vars.APP_NAME }}
registry: ${{ vars.GAR_BASE }}
secrets: inherit

deploy:
needs: [build]
uses: ./.github/workflows/sub-cloudrun-deploy.yml
with:
environment: test
project_id: ${{ vars.GCP_PROJECT }}
region: ${{ vars.GCP_REGION }}
app_name: ${{ vars.APP_NAME }}
registry: ${{ vars.GAR_BASE }}
image_digest: ${{ needs.build.outputs.image_digest }}
min_instances: '0'
max_instances: '30'
cpu: '1'
memory: 1Gi
secrets: inherit
35 changes: 35 additions & 0 deletions .github/workflows/chore-clean-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Clean dev instances

on:
delete:
pull_request:
branches:
- main
types:
- closed

permissions: read-all

jobs:
delete:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected]
with:
workload_identity_provider: '${{ vars.GCP_WIF }}'
project_id: '${{ vars.GCP_PROJECT }}'

- name: Set up Cloud SDK
uses: google-github-actions/[email protected]

- name: Removing CR service
run: |
gcloud run services delete ${{ vars.APP_NAME }}-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} --region=${{ vars.GOOGLE_CLOUD_REGION }} --quiet
18 changes: 18 additions & 0 deletions .github/workflows/ci-lint-codebase.patch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint Code Base

on:
pull_request:
branches: [main]
paths-ignore:
- '**/Dockerfile'
- 'scripts/**'
- 'etc/litestream.yml'
- .github/workflows/ci-lint-codebase.yml

permissions: read-all

jobs:
linter:
runs-on: ubuntu-latest
steps:
- run: echo "Job not required"
57 changes: 57 additions & 0 deletions .github/workflows/ci-lint-codebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Lint Code Base

on:
pull_request:
branches: [main]
paths:
- '**/Dockerfile'
- 'scripts/**'
- 'etc/litestream.yml'
- .github/workflows/ci-lint-codebase.yml

push:
branches: [main]
paths:
- '**.sh*'
- '**.ts*'
- Dockerfile
- package.json
- pnpm-lock.yaml
- .github/workflows/ci-lint-codebase.yml

concurrency:
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions: read-all

jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/[email protected]
with:
# Full git history is needed to get a proper
# list of changed files within `super-linter`
fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter/[email protected]
env:
LOG_LEVEL: ERROR
VALIDATE_ALL_CODEBASE: false
VALIDATE_SHELL_SHFMT: false
VALIDATE_JSCPD: false
VALIDATE_CSS: false
VALIDATE_EDITORCONFIG: false
VALIDATE_MARKDOWN: false
VALIDATE_JAVASCRIPT_ES: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_DOCKERFILE_HADOLINT: false
LINTER_RULES_PATH: /
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading