Skip to content

Commit

Permalink
Merge pull request #1279 from softwaremill/generate-openapi-spec
Browse files Browse the repository at this point in the history
Generate OpenAPI spec during compile
  • Loading branch information
adamw authored Jan 15, 2025
2 parents d96b1f8 + 9289c0e commit 12fbde1
Show file tree
Hide file tree
Showing 89 changed files with 5,633 additions and 5,573 deletions.
58 changes: 26 additions & 32 deletions .github/workflows/bootzooka-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@ on:
release:
types:
- released
paths-ignore:
- "helm/**"

jobs:
verify:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Check-out repository
id: repo-checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 21
id: jdk-setup
uses: actions/setup-java@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu'
java-version: '21'
cache: 'sbt'

- name: Cache SBT
id: cache-sbt
uses: actions/cache@v2
- uses: sbt/setup-sbt@v1

- name: Set up Node.js
uses: actions/setup-node@v4
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
node-version: 22

- name: Generate OpenAPI Spec
id: generate-openapi-spec
run: sbt "backend/generateOpenAPIDescription"

- name: Run tests
id: run-tests
Expand All @@ -51,38 +51,31 @@ jobs:
deploy:
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
needs: [ verify ]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Check-out repository
id: repo-checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 21
id: jdk-setup
uses: actions/setup-java@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21

- name: Cache SBT
id: cache-sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
distribution: 'zulu'
java-version: '21'
cache: 'sbt'

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract version
run: |
version=${GITHUB_REF/refs\/tags\/v/}
echo "VERSION=$version" >> $GITHUB_ENV
- name: Publish release notes
uses: release-drafter/release-drafter@v5
with:
Expand All @@ -93,5 +86,6 @@ jobs:
version: "v${{ env.VERSION }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish docker image
run: sbt backend/docker:publish
8 changes: 4 additions & 4 deletions .github/workflows/bootzooka-helm-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
lint-chart:
name: Lint Helm Chart
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Check-out repository
id: repo-checkout
Expand All @@ -34,7 +34,7 @@ jobs:
needs:
- lint-chart
name: Install & Test Helm Chart
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
k8s:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- lint-chart
- install-test-chart
name: Validate Helm Chart Docs
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Check-out repository
id: repo-checkout
Expand All @@ -91,7 +91,7 @@ jobs:
- install-test-chart
- validate-chart-docs
name: Publish Helm Chart
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Check-out repository
id: repo-checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scala-steward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
scala-steward:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
39 changes: 35 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,44 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
/coverage

# production
build
target

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
ui/.env

npm-debug.log*
yarn-debug.log*
yarn-error.log*

*.log
work.txt

# generated code
/ui/src/api-client/openapi.d.ts

# IDE
*.iml
*.ipr
*.iws
.idea/
target/
*.log
.DS_Store
data/
*.bloop
*.metals
.vscode
metals.sbt
.bsp

metals.sbt
Expand Down
5 changes: 0 additions & 5 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
updates.ignore = [
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "2.12."},
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "2.13."},
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "3."}
]
2 changes: 2 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OrganizeImports.groupedImports = AggressiveMerge
OrganizeImports.targetDialect = Scala3
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@

## Quick start

### Using Docker compose

The fastest way to experiment with Bootzooka is using the provided Docker compose setup. It starts three images:
Bootzooka itself (either locally built or downloaded), PostgreSQL server and Graphana LGTM for observability.

### Backend: PostgreSQL & API

In order to run Bootzooka, you'll need a running instance of PostgreSQL with a `bootzooka` database. You can spin
up one easily using docker:
To run Bootzooka's backend locally, you'll still need a running instance of PostgreSQL with a `bootzooka` database.
You can spin up one easily using docker:

```sh
# use "bootzooka" as a password
Expand All @@ -19,10 +24,12 @@ docker run --name bootzooka-postgres -p 5432:5432 -e POSTGRES_PASSWORD=bootzooka
Then, you can start the backend:

```sh
export SQL_PASSWORD=bootzooka
./backend-start.sh
OTEL_SDK_DISABLED=true SQL_PASSWORD=bootzooka ./backend-start.sh
```

Unless you've got an OpenTelemetry collector running, OpenTelemetry should be disabled to avoid telemetry export
exceptions.

### Frontend: Yarn & webapp

You will need the [yarn package manager](https://yarnpkg.com) to run the UI. Install it using your package manager or:
Expand Down
2 changes: 0 additions & 2 deletions backend/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ db {
migrate-on-start = ${?MIGRATE_ON_START}

driver = "org.postgresql.Driver"

connect-thread-pool-size = 32
}

email {
Expand Down
36 changes: 23 additions & 13 deletions backend/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>

<configuration scan="true">
<configuration>
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>

<if condition='p("LOGBACK_JSON_ENCODE").equals("true")'>
<then>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
</then>
<else>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS}%boldYellow(%replace( [%X{cid}] ){' \[\] ', ' '})[%thread] %-5level %logger{5} - %msg%n%rEx</pattern>
</encoder>
</appender>
<encoder>
<pattern><![CDATA[%d{HH:mm:ss.SSS}%boldYellow(%replace( [%X{cid}] ){' \[\] ', ' '})[%thread] %-5level %logger{5} - %msg%n%rEx]]></pattern>
</encoder>
</appender>
</else>
</if>

<appender name="OpenTelemetry"
class="io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender"></appender>

<logger name="com.softwaremill.bootzooka" level="${LOG_LEVEL:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT"/>
<appender-ref ref="STDOUT" />
<appender-ref ref="OpenTelemetry" />
</logger>

<logger name="sttp.client3" level="${LOG_LEVEL:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT"/>
<logger name="sttp.client3" level="${LOG_LEVEL:-INFO}" additivity="false">
<appender-ref ref="STDOUT" />
<appender-ref ref="OpenTelemetry" />
</logger>

<logger name="sttp.tapir" level="${LOG_LEVEL:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT"/>
<appender-ref ref="STDOUT" />
<appender-ref ref="OpenTelemetry" />
</logger>

<root level="${LOG_LEVEL:-INFO}">
<appender-ref ref="STDOUT"/>
<appender-ref ref="STDOUT" />
<appender-ref ref="OpenTelemetry" />
</root>

</configuration>
</configuration>
1 change: 1 addition & 0 deletions backend/src/main/resources/psw4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global.salt.length=64
Loading

0 comments on commit 12fbde1

Please sign in to comment.