Skip to content

Commit

Permalink
Fixes #6 and #8 [no ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir committed Apr 10, 2023
1 parent 52a9c5f commit c35da88
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 958 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: slominskir/${{ github.event.repository.name }}-weblib
repository: jeffersonlab/${{ github.event.repository.name }}
short-description: ${{ github.event.repository.description }}
40 changes: 0 additions & 40 deletions .github/workflows/docker-publish-demo.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
slominskir/${{ github.event.repository.name }}-weblib
jeffersonlab/${{ github.event.repository.name }}-demo
tags: |
type=semver,pattern={{version}}
-
Expand All @@ -32,7 +32,6 @@ jobs:
name: Push to Docker Hub
uses: docker/build-push-action@v3
with:
file: Dockerfile-weblib
push: true
build-args: |
CUSTOM_CRT_URL=http://pki.jlab.org/JLabCA.crt
Expand Down
13 changes: 10 additions & 3 deletions Dockerfile-demo → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILD_IMAGE=gradle:7.4-jdk17
ARG RUN_IMAGE=slominskir/smoothness-weblib:3.13.0
ARG RUN_IMAGE=jeffersonlab/wildfly:1.0.0

################## Stage 0
FROM ${BUILD_IMAGE} as builder
Expand All @@ -18,6 +18,13 @@ 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/demo/smoothness-demo-setup.env /
RUN /app-setup.sh /smoothness-demo-setup.env \
&& rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history
USER root
RUN /server-setup.sh /smoothness-demo-setup.env wildfly_start_and_wait \
&& /app-setup.sh /smoothness-demo-setup.env config_keycloak_client \
&& /app-setup.sh /smoothness-demo-setup.env config_oracle_client \
&& /server-setup.sh /smoothness-demo-setup.env config_email \
&& /server-setup.sh /smoothness-demo-setup.env wildfly_reload \
&& /server-setup.sh /smoothness-demo-setup.env wildfly_stop \
&& rm -rf /opt/jboss/wildfly/standalone/configuration/standalone_xml_history \
USER jboss:jboss
COPY --from=builder /app/smoothness-demo/build/libs/* /opt/jboss/wildfly/standalone/deployments
63 changes: 0 additions & 63 deletions Dockerfile-weblib

This file was deleted.

36 changes: 12 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# smoothness [![CI](https://github.com/JeffersonLab/smoothness/actions/workflows/ci.yml/badge.svg)](https://github.com/JeffersonLab/smoothness/actions/workflows/ci.yml) [![Docker (weblib)](https://img.shields.io/docker/v/slominskir/smoothness-weblib?sort=semver&label=DockerHub+weblib)](https://hub.docker.com/r/slominskir/smoothness-weblib) [![Docker (demo)](https://img.shields.io/docker/v/slominskir/smoothness-demo?sort=semver&label=DockerHub+demo)](https://hub.docker.com/r/slominskir/smoothness-demo) [![Maven Central](https://badgen.net/maven/v/maven-central/org.jlab/smoothness-weblib)](https://repo1.maven.org/maven2/org/jlab/smoothness-weblib/)
# smoothness [![CI](https://github.com/JeffersonLab/smoothness/actions/workflows/ci.yml/badge.svg)](https://github.com/JeffersonLab/smoothness/actions/workflows/ci.yml) [![Docker (demo)](https://img.shields.io/docker/v/jeffersonlab/smoothness-demo?sort=semver&label=DockerHub+demo)](https://hub.docker.com/r/jeffersonlab/smoothness-demo) [![Maven Central](https://badgen.net/maven/v/maven-central/org.jlab/smoothness-weblib)](https://repo1.maven.org/maven2/org/jlab/smoothness-weblib/)
A [Java EE 8](https://en.wikipedia.org/wiki/Jakarta_EE) web application template and [JSP tag library](https://docs.oracle.com/javaee/5/tutorial/doc/bnama.html) based on the [JQuery UI Smoothness](https://jqueryui.com/themeroller/) theme. The included demo web application showcases the template layout.

![Screenshot](https://github.com/JeffersonLab/smoothness/raw/main/smoothness-demo/Screenshot.png?raw=true "Screenshot")
Expand Down Expand Up @@ -185,41 +185,29 @@ gradlew build
**See**: [Docker Development Quick Reference](https://gist.github.com/slominskir/a7da801e8259f5974c978f9c3091d52c#development-quick-reference)

## Release
Since this is a monorepo there are actually two projects: the weblib and the demo of the weblib. Further, both projects have two artifacts: a Java distributable (demo war and weblib jar) and a Docker image. The Docker build is complicated by fact that dependencies 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 attempt to avoid needing two tags per release by updating the demo image reference to point to the upcoming release before it even exists.
Since this is a monorepo there are actually two projects: the weblib and the demo of the weblib. Further, both projects have two artifacts: a Java distributable (demo war and weblib jar), plus there is a demo Docker image.

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.
2. To confirm the new Docker images are good, run the docker build locally for weblib and tag it as SNAPSHOT for testing with demo:
```
docker build -f Dockerfile-weblib --build-arg CUSTOM_CRT_URL=http://pki.jlab.org/JLabCA.crt . -t weblib:snapshot --no-cache --progress=plain
```
**Note**: This step could go in the `build.yml` if there was a way to instruct services to depend on each other at BUILD time. Currently `depends_on` only works at runtime (builds are parallel).
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.

3. Build the "build" compose project that leverages the SNAPSHOT weblib and test it before moving forward:
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.
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.yml up
```
4. Bump the version number and release date in settings.gradle and commit and push to GitHub (using [Semantic Versioning](https://semver.org/)).
5. Update Dockerfile-demo to use the new weblib image version and commit and push to GitHub. Do this first before creating release else you'll have to create second release since we run Docker build from GitHub tag.

**WEBLIB**
1. 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.
2. Publish new artifact on maven central with:
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 new artifact on maven central with:
```
gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
```
**Note**: There is a [GitHub action](https://github.com/JeffersonLab/smoothness/actions/workflows/maven-publish.yml) for this to happen automatically. To run locally you'll need to configure credentials. See: [Gradle Publish Notes](https://gist.github.com/slominskir/5fcd5cf84182bf1542c07cbca953904a)

3. Build and push [Docker image](https://gist.github.com/slominskir/a7da801e8259f5974c978f9c3091d52c#8-build-an-image-based-of-github-tag). For the weblib so use `-f Dockerfile-weblib`. This time we use the github tagged context instead of local `.`. This is automated as a [GitHub Action](https://github.com/JeffersonLab/smoothness/actions/workflows/docker-publish.yml) and should be done automatically on new release published.

4. Update javadocs and tlddocs by copying them from build dir into gh-pages branch and updating index.html (commit, push). This should occur automatically via [Publish to gh-pages](https://github.com/JeffersonLab/smoothness/actions/workflows/gh-pages-publish.yml) GitHub Action.
5. Copy updated minified JS and CSS to any CDN as needed.

**DEMO**

1. Build and push Docker image for the demo `-f Dockerfile-demo`. You must wait for weblib image to post on DockerHub else build on same host with already locally cached weblib image. This is automated as a [GitHub Action](https://github.com/JeffersonLab/smoothness/actions/workflows/docker-publish-demo.yml) but must be manually invoked after the weblib image is published.
2. Bump and commit quick start [image version](https://github.com/JeffersonLab/smoothness/blob/main/docker-compose.override.yml). For the demo.
5. Build and push [Docker image](https://gist.github.com/slominskir/a7da801e8259f5974c978f9c3091d52c#8-build-an-image-based-of-github-tag) for the demo. This time we use the github tagged context instead of local `.`. This is automated as a [GitHub Action](https://github.com/JeffersonLab/smoothness/actions/workflows/docker-publish.yml) and should be done automatically on new release published.
6. Update javadocs and tlddocs by copying them from build dir into gh-pages branch and updating index.html (commit, push). This should occur automatically via [Publish to gh-pages](https://github.com/JeffersonLab/smoothness/actions/workflows/gh-pages-publish.yml) GitHub Action.
7. Copy updated minified JS and CSS to any CDN as needed.
8. Bump and commit quick start [image version](https://github.com/JeffersonLab/smoothness/blob/main/docker-compose.override.yml). For the demo.

## See Also
- [Beam authorization manager (BAM)](https://github.com/JeffersonLab/bam)
Expand Down
114 changes: 0 additions & 114 deletions bash/wildfly/app-setup.sh

This file was deleted.

56 changes: 0 additions & 56 deletions bash/wildfly/deploy.sh

This file was deleted.

Loading

0 comments on commit c35da88

Please sign in to comment.