Skip to content

Commit

Permalink
deployment setup (#9)
Browse files Browse the repository at this point in the history
* update cd properties; split config for dev & prod

* create fly configuration

* update fly image after deploy
  • Loading branch information
thwbh authored Nov 7, 2024
1 parent c7aa5c4 commit 313aa88
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 20 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
id: semver
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
default-version: '0.0.1'
prerelease: 'alpha'
default-version: '0.9.0'

- name: Build kamifusen
run: |
./gradlew build -Dquarkus.package.type=native -Dversion=${{ steps.semver.outputs.semantic-version }}
./gradlew build -Dquarkus.native.enabled=true -Dversion=${{ steps.semver.outputs.semantic-version }} \
&& echo "quarkus.http.auth.session.encryption-key=${{ secrets.AUTH_ENCRYPTION_KEY }}" >> src/main/resources/application.properties
- name: Build kamifusen native-micro image
run: |
Expand All @@ -49,12 +49,16 @@ jobs:
- name: Push kamifusen jvm native-micro image to ghcr
run: docker push ghcr.io/tohuwabohu-io/kamifusen:${{ steps.semver.outputs.semantic-version }}

# - name: Deploy kamifusen
# run: |
# flyctl deploy -a kamifusen -i \
# ghcr.io/tohuwabohu-io/kamifusen:${{ steps.semver.outputs.semantic-version }} \
# --image-label ${{ steps.semver.outputs.semantic-version }} --local-only --no-cache \
# && flyctl secrets set -a kamifusen --detach \
# QUARKUS_DATASOURCE_PASSWORD=${{ secrets.DB_PWD }} \
# QUARKUS_DATASOURCE_REACTIVE_URL=${{ secrets.DB_URL }} \
# QUARKUS_DATASOURCE_USERNAME=${{ secrets.DB_USER }}
- name: Deploy kamifusen
run: |
flyctl deploy -a kamifusen -i \
ghcr.io/tohuwabohu-io/kamifusen:${{ steps.semver.outputs.semantic-version }} \
--image-label ${{ steps.semver.outputs.semantic-version }} --local-only --no-cache \
&& flyctl secrets set -a kamifusen --detach \
QUARKUS_DATASOURCE_PASSWORD=${{ secrets.DB_PWD }} \
QUARKUS_DATASOURCE_REACTIVE_URL=${{ secrets.DB_URL }} \
QUARKUS_DATASOURCE_USERNAME=${{ secrets.DB_USER }}
- name: Update kamifusen image version
run: |
flyctl image update -a kamifusen --image registry.fly.io/kamifusen:${{ steps.semver.outputs.semantic-version }} -y
20 changes: 20 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# fly.toml app configuration file generated for kamifusen on 2024-11-06T19:51:33+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'kamifusen'
primary_region = 'fra'

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
20 changes: 12 additions & 8 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# common config
quarkus.application.name=kamifusen
quarkus.application.version=0.0.1
quarkus.application.version=0.9.0

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=kamifusen
quarkus.datasource.password=kamifusen
quarkus.datasource.reactive.url=postgresql://localhost:5432/dev
quarkus.datasource.reactive=true

quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.database.generation=none
quarkus.hibernate-orm.physical-naming-strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQLDialect

quarkus.live-reload.instrumentation=true

quarkus.jacoco.excludes=io/tohuwabohu/kamifusen/crud/*

quarkus.http.auth.basic=true
Expand All @@ -36,4 +32,12 @@ quarkus.http.auth.form.cookie-path=/
quarkus.http.auth.permission.form.paths=/
quarkus.http.auth.permission.form.policy=authenticated

quarkus.http.auth.session.encryption-key=encryption-key-3000
# dev config
%dev.quarkus.datasource.username=kamifusen
%dev.quarkus.datasource.password=kamifusen
%dev.quarkus.datasource.reactive.url=postgresql://localhost:5432/dev

%dev.quarkus.live-reload.instrumentation=true
%dev.quarkus.hibernate-orm.database.generation=drop-and-create
%dev.quarkus.http.auth.session.encryption-key=encryption-key-3000
%dev.quarkus.log.level=DEBUG

0 comments on commit 313aa88

Please sign in to comment.