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

Workflow updates #20

Merged
merged 5 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 47 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CD

on:
push:
paths:
- 'VERSION'

jobs:
release:
uses: jeffersonlab/java-workflows/.github/workflows/gh-release.yml@v1
with:
files: smoothness-demo/build/libs/smoothness-demo.war
secrets: inherit

artifact_publish:
needs:
- release
uses: jeffersonlab/java-workflows/.github/workflows/maven-publish.yml@v1
secrets: inherit

docs_publish:
needs:
- release
uses: jeffersonlab/java-workflows/.github/workflows/gh-pages-publish.yml@v1
with:
semvertag: ${{ needs.release.outputs.semvertag }}
folder: smoothness-weblib/build/docs
secrets: inherit

docker_publish:
needs:
- release
uses: jeffersonlab/container-workflows/.github/workflows/docker-publish.yml@v1
with:
semvertag: ${{ needs.release.outputs.semvertag }}
images: jeffersonlab/${{ github.event.repository.name }}-demo
secrets: inherit

acctest_deploy:
needs:
- release
uses: jeffersonlab/general-workflows/.github/workflows/jlab-deploy-app.yml@v1
with:
app: smoothness-demo
env: acctest
ver: ${{ needs.release.outputs.semver }}
secrets: inherit
19 changes: 6 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: CI
on:
push:
branches: [ main ]
paths-ignore:
- 'VERSION'
tags-ignore:
- "v*.*.*"
pull_request:
branches: [ main ]
workflow_dispatch:
Expand All @@ -11,16 +15,5 @@ permissions:
contents: read

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
- name: Build with Gradle
run: ./gradlew build
build:
uses: jeffersonlab/java-workflows/.github/workflows/unit-ci.yml@v1
16 changes: 5 additions & 11 deletions .github/workflows/docker-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ on:
- .github/workflows/docker-description.yml
jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: jeffersonlab/${{ github.event.repository.name }}-demo
short-description: ${{ github.event.repository.description }}
uses: jeffersonlab/container-workflows/.github/workflows/docker-description.yml@v1
with:
repository: jeffersonlab/${{ github.event.repository.name }}-demo
description: ${{ github.event.repository.description }}
secrets: inherit
39 changes: 0 additions & 39 deletions .github/workflows/docker-publish.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/gh-pages-publish.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/maven-publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN cd /app && gradle build -x test --no-watch-fs $OPTIONAL_CERT_ARG

################## Stage 1
FROM ${RUN_IMAGE} as runner
COPY --from=builder /app/docker/app/app-setup.env /
COPY --from=builder /app/container/app/app-setup.env /
USER root
RUN /server-setup.sh /app-setup.env wildfly_start_and_wait \
&& /app-setup.sh /app-setup.env config_keycloak_client \
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Check the [Release Notes](https://github.com/JeffersonLab/smoothness/releases) t
### Demo Install
This application requires a Java 11+ JVM and standard library to run, plus a Java EE 8+ application server (developed with Wildfly). Use the Docker Compose quickstart to automate the setup of the app, else manually:

1. Install service [dependencies](https://github.com/JeffersonLab/smoothness/blob/main/deps.yml)
1. Install service [dependencies](https://github.com/JeffersonLab/smoothness/blob/main/deps.yaml)
2. Download [Wildfly 26.1.3](https://www.wildfly.org/downloads/)
3. [Configure](https://github.com/JeffersonLab/smoothness#configure) Wildfly and start it
4. Download [demo.war](https://github.com/JeffersonLab/smoothness-demo/releases) and deploy it to Wildfly
Expand Down Expand Up @@ -142,7 +142,7 @@ gradlew build
## Develop
In order to iterate rapidly when making changes it's often useful to run the app directly on the local workstation, perhaps leveraging an IDE. In this scenario run the service dependencies with:
```
docker compose -f deps.yml up
docker compose -f deps.yaml up
```
**Note**: The local install of Wildfly should be [configured](https://github.com/JeffersonLab/smoothness#configure) to proxy connections to services via localhost and therefore the environment variables should contain:
```
Expand All @@ -158,20 +158,20 @@ Since this is a monorepo there are actually two projects: the weblib and the dem

Dependencies (libraries) generally should be installed directly into Wildfly as opposed to being bundled inside a war file, but the smoothness weblib itself should not and must be packaged inside the war file of each app using the lib. This is necessary as the smoothness weblib is [incompatible as a JBoss Module](https://github.com/JeffersonLab/smoothness/issues/4), plus this bundling makes development of the lib easier as it allows iteration without constantly updating weblib code installed in Wildfly. Since the demo has a dependency on the weblib, either all artifacts needed for both subprojects need to tagged together, else two separate releases would be needed as a release corresponds to a git tag and Docker images are built using the Git tag context. We use a shared release.

1. During development the build is run locally to ensure everything is working. You can use deps.yml Docker Compose in concert with a local Wildfly instance to quickly iterate.
1. During development the build is run locally to ensure everything is working. You can use deps.yaml Docker Compose in concert with a local Wildfly instance to quickly iterate.
2. To confirm the new demo Docker image is good, run the docker build and test locally:
```
docker compose -f build.yml build demo --no-cache --progress=plain
docker compose -f build.yaml build demo --no-cache --progress=plain
...
docker compose -f build.yml up
docker compose -f build.yaml up
```
3. Bump the version number and release date in settings.gradle and commit and push to GitHub (using [Semantic Versioning](https://semver.org/)).
4. Create a new release on the GitHub [Releases](https://github.com/JeffersonLab/smoothness/releases) page corresponding to same version in settings.gradle (Enumerate changes and link issues). Attach the smoothness-demo.war.
5. [Publish to MavenCentral](https://github.com/JeffersonLab/smoothness/actions/workflows/maven-publish.yml) GitHub Action should run automatically.
7. [Publish to gh-pages](https://github.com/JeffersonLab/smoothness/actions/workflows/gh-pages-publish.yml) GitHub Action should run automatically.
8. [Publish to DockerHub](https://github.com/JeffersonLab/smoothness/actions/workflows/docker-publish.yml) GitHub Action should run automatically.
9. Copy updated minified JS and CSS to any CDN as needed.
10. Bump and commit quick start [image version](https://github.com/JeffersonLab/smoothness/blob/main/docker-compose.override.yml). For the demo.
10. Bump and commit quick start [image version](https://github.com/JeffersonLab/smoothness/blob/main/compose.override.yaml). For the demo.

## Deploy
At JLab this app is found at [ace.jlab.org/smoothness-demo](https://ace.jlab.org/smoothness-demo) and internally at [acctest.acc.jlab.org/smoothness-demo](https://acctest.acc.jlab.org/smoothness-demo). However, those servers are proxies for `wildfly5.acc.jlab.org` and `wildflytest5.acc.jlab.org` respectively. A [deploy script](https://github.com/JeffersonLab/wildfly/blob/main/scripts/deploy.sh) is provided to automate wget and deploy. Example:
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.5.0
12 changes: 6 additions & 6 deletions bind.yml → bind.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
services:
oracle:
extends:
file: build.yml
file: build.yaml
service: oracle

keycloak:
extends:
file: build.yml
file: build.yaml
service: keycloak

puppet:
extends:
file: build.yml
file: build.yaml
service: puppet

mailhog:
extends:
file: build.yml
file: build.yaml
service: mailhog

weblib:
extends:
file: build.yml
file: build.yaml
service: weblib

demo:
extends:
file: build.yml
file: build.yaml
service: demo
10 changes: 5 additions & 5 deletions build.yml → build.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
services:
oracle:
extends:
file: docker-compose.yml
file: compose.yaml
service: oracle
volumes:
- ./run/oracle/oradata:/opt/oracle/oradata

keycloak:
extends:
file: docker-compose.yml
file: compose.yaml
service: keycloak

puppet:
extends:
file: docker-compose.yml
file: compose.yaml
service: puppet

mailhog:
extends:
file: docker-compose.yml
file: compose.yaml
service: mailhog

demo:
extends:
file: docker-compose.yml
file: compose.yaml
service: demo
build:
context: .
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions docker-compose.yml → compose.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
services:
oracle:
extends:
file: deps.yml
file: deps.yaml
service: oracle

keycloak:
extends:
file: deps.yml
file: deps.yaml
service: keycloak

puppet:
extends:
file: deps.yml
file: deps.yaml
service: puppet

mailhog:
extends:
file: deps.yml
file: deps.yaml
service: mailhog

demo:
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions container/keycloak/initd.d/00_config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export KEYCLOAK_REALM=test-realm
export KEYCLOAK_RESOURCE=smoothness-demo
8 changes: 8 additions & 0 deletions container/keycloak/initd.d/01_login.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

. /lib.sh

echo "---------"
echo "| Login |"
echo "---------"
login
15 changes: 15 additions & 0 deletions container/keycloak/initd.d/02_realm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

. /lib.sh

echo "----------------"
echo "| Create Realm |"
echo "----------------"
# KEYCLOAK_REALM set in 00_config.env as it's a shared value
KEYCLOAK_SECRET=yHi6W2raPmLvPXoxqMA7VWbLAA2WN0eB
KEYCLOAK_REALM_DISPLAY_NAME="TEST REALM"
# TIMEOUT UNITS IS SECONDS; 28800 Seconds = 8 Hours
KEYCLOAK_SESSION_IDLE_TIMEOUT=28800
# 86400 Seconds = 24 Hours
KEYCLOAK_SESSION_MAX_LIFESPAN=86400
create_realm
Loading