Skip to content

Commit

Permalink
Tener distribution unitaria (#232)
Browse files Browse the repository at this point in the history
* Use single distribution

* Corregir CI y maven profiles

* Change whoami resource location

* Change images configuration

* Remove comment space

* Change profiles
  • Loading branch information
carlosthe19916 authored Apr 25, 2022
1 parent 07255d7 commit b0ad96b
Show file tree
Hide file tree
Showing 70 changed files with 606 additions and 1,385 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:
native-tests:
name: Native Tests
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [ "standalone", "enterprise" ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -39,7 +35,7 @@ jobs:
distribution: temurin
cache: maven
- name: Build with Maven
run: mvn verify -Dquarkus.native.container-build=true -P native,${{ matrix.flavor }}
run: mvn verify -Dquarkus.native.container-build=true -P native

ui-tests:
name: UI Tests
Expand Down
82 changes: 0 additions & 82 deletions .github/workflows/pr-build-container-images-comment-boot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
The creation of the container image might take aproximately 10 minutes. Once it is available you can pull it using:
```shell
docker pull ghcr.io/${{github.event.pull_request.head.repo.full_name}}/${{github.event.repository.name}}:${{github.event.pull_request.head.ref}}
docker pull ghcr.io/${{github.event.pull_request.head.repo.full_name}}/${{github.event.repository.name}}-enterprise:${{github.event.pull_request.head.ref}}
```
- To watch the current status of the container image creation visit [Workflow runs](https://github.com/${{github.event.pull_request.head.repo.full_name}}/actions/workflows/pr-build-container-images.yml?query=branch%3A${{github.event.pull_request.head.ref}})
Expand Down Expand Up @@ -65,86 +64,5 @@ jobs:
condition: service_healthy
```
</details>
<details>
<summary>Docker compose - enterprise</summary>
<br />
```yaml
version: "3"
services:
postgresql:
image: postgres:13.1
environment:
POSTGRES_DB: searchpe_db
POSTGRES_USER: db_username
POSTGRES_PASSWORD: db_password
network_mode: "host"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U db_username -d searchpe_db" ]
interval: 10s
timeout: 5s
retries: 5
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
environment:
discovery.type: single-node
network_mode: "host"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9200" ]
interval: 10s
timeout: 5s
retries: 5
keycloak:
image: quay.io/keycloak/keycloak:15.0.2
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
KEYCLOAK_IMPORT: /tmp/openubl-realm.json
DB_VENDOR: h2
volumes:
- ./src/main/resources/openubl-realm.json:/tmp/openubl-realm.json:z
command:
- "-Djboss.bind.address.private=127.0.0.1"
- "-Djboss.bind.address=0.0.0.0"
network_mode: "host"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/auth" ]
interval: 10s
timeout: 5s
retries: 5
searchpe:
image: quay.io/projectopenubl/searchpe-enterprise:early-access
environment:
QUARKUS_HTTP_PORT: 8180
QUARKUS_DATASOURCE_USERNAME: db_username
QUARKUS_DATASOURCE_PASSWORD: db_password
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://localhost:5432/searchpe_db
QUARKUS_OIDC_ENABLED: "true"
QUARKUS_OIDC_AUTH_SERVER_URL: http://localhost:8080/auth/realms/openubl
QUARKUS_OIDC_CLIENT_ID: searchpe
QUARKUS_OIDC_CREDENTIALS_SECRET: secret
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_USERNAME: any
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_PASSWORD: any
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_PROTOCOL: HTTP
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_HOSTS: localhost:9200
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_VERSION: 7
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/q/health" ]
interval: 10s
timeout: 5s
retries: 5
network_mode: "host"
depends_on:
postgresql:
condition: service_healthy
elasticsearch:
condition: service_healthy
keycloak:
condition: service_healthy
```
</details>
repo-token: ${{ steps.token.outputs.GH_TOKEN }}
18 changes: 1 addition & 17 deletions .github/workflows/pr-build-container-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ jobs:
container-images:
if: ${{ github.event_name != 'pull_request' && github.repository_owner != 'project-openubl' }}
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [ "standalone", "enterprise" ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -18,18 +14,6 @@ jobs:
distribution: temurin
cache: maven

- name: Extract image name
shell: bash
run: |
bash -c '
flavor=${{ matrix.flavor }};
image_name="searchpe";
if [ $flavor != "standalone" ]; then
image_name="$image_name-$flavor"
fi
echo $image_name;
echo "##[set-output name=searchpe_image_name;]$(echo $image_name)"'
id: extract_image_name
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
Expand All @@ -43,7 +27,7 @@ jobs:
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=ghcr.io \
-Dquarkus.container-image.group=${{ github.repository_owner }} \
-Dquarkus.container-image.name=${{ github.event.repository.name }}/${{ steps.extract_image_name.outputs.searchpe_image_name }} \
-Dquarkus.container-image.name=${{ github.event.repository.name }}/searchpe \
-Dquarkus.container-image.tag=${{ steps.extract_branch.outputs.branch }} \
-Dquarkus.container-image.username=${{ github.actor }} \
-Dquarkus.container-image.password=${{ secrets.GITHUB_TOKEN }} \
Expand Down
33 changes: 8 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ jobs:
build-jvm:
needs: [ version ]
name: Build JVM
strategy:
fail-fast: true
matrix:
flavor: [ "standalone", "enterprise" ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand All @@ -79,7 +75,7 @@ jobs:
cache: maven

- name: Build and Create distribution
run: mvn -B --file pom.xml package -DskipTests -P ui,distribution-${{ matrix.flavor }}
run: mvn -B --file pom.xml package -DskipTests -P ui,distribution
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -91,10 +87,6 @@ jobs:
build-container:
needs: [ version ]
name: Build Container
strategy:
fail-fast: true
matrix:
flavor: [ "standalone", "enterprise" ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand Down Expand Up @@ -124,16 +116,16 @@ jobs:
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=quay.io \
-Dquarkus.container-image.group=projectopenubl \
-Dquarkus.container-image.name=searchpe-${{ matrix.flavor }} \
-Dquarkus.container-image.name=searchpe \
-Dquarkus.container-image.tag=latest \
-P native,ui,${{ matrix.flavor }}
-P native,ui
- name: Save container image
run: docker save -o searchpe-${{ matrix.flavor }}-container-image.tar quay.io/projectopenubl/searchpe-${{ matrix.flavor }}:latest
run: docker save -o searchpe-container-image.tar quay.io/projectopenubl/searchpe:latest
- name: Upload container image
uses: actions/upload-artifact@v3
with:
name: artifacts
path: searchpe-${{ matrix.flavor }}-container-image.tar
path: searchpe-container-image.tar

release:
needs: [ build-jvm, build-container ]
Expand Down Expand Up @@ -171,14 +163,11 @@ jobs:
- name: Load and config images
run: |
# Load images from .tar
docker load -i artifacts/searchpe-standalone-container-image.tar
docker load -i artifacts/searchpe-enterprise-container-image.tar
docker load -i artifacts/searchpe-container-image.tar
# Tag images
docker tag quay.io/projectopenubl/searchpe-standalone:latest quay.io/projectopenubl/searchpe:latest
docker tag quay.io/projectopenubl/searchpe-standalone:latest quay.io/projectopenubl/searchpe:${{ steps.version.outputs.RELEASE_VERSION }}
docker tag quay.io/projectopenubl/searchpe-enterprise:latest quay.io/projectopenubl/searchpe-standalone:${{ steps.version.outputs.RELEASE_VERSION }}
docker tag quay.io/projectopenubl/searchpe-enterprise:latest quay.io/projectopenubl/searchpe-enterprise:${{ steps.version.outputs.RELEASE_VERSION }}
docker tag quay.io/projectopenubl/searchpe:latest quay.io/projectopenubl/searchpe:latest
docker tag quay.io/projectopenubl/searchpe:latest quay.io/projectopenubl/searchpe:${{ steps.version.outputs.RELEASE_VERSION }}
- name: Login to Quay.io
uses: docker/login-action@v1
Expand All @@ -191,12 +180,6 @@ jobs:
run: |
docker push quay.io/projectopenubl/searchpe:latest
docker push quay.io/projectopenubl/searchpe:v${{ steps.version.outputs.RELEASE_VERSION }}
docker push quay.io/projectopenubl/searchpe-standalone:latest
docker push quay.io/projectopenubl/searchpe-standalone:v${{ steps.version.outputs.RELEASE_VERSION }}
docker push quay.io/projectopenubl/searchpe-enterprise:latest
docker push quay.io/projectopenubl/searchpe-enterprise:v${{ steps.version.outputs.RELEASE_VERSION }}
- name: Release with JReleaser
uses: jreleaser/release-action@v1
Expand Down
35 changes: 10 additions & 25 deletions .github/workflows/snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ jobs:
distribution: temurin
cache: maven
- name: Maven
run: mvn test -Pstandalone -Dtest=DataHelperTest -Dsearchpe.sunat.padronReducidoUrl=http://www2.sunat.gob.pe/padron_reducido_ruc.zip
run: mvn test -Dtest=DataHelperTest -Dsearchpe.sunat.padronReducidoUrl=http://www2.sunat.gob.pe/padron_reducido_ruc.zip

build-snapshot-container:
needs: [ linux-jvm-tests ]
name: Build Container
strategy:
matrix:
flavor: [ "standalone", "enterprise" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -46,16 +43,16 @@ jobs:
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=quay.io \
-Dquarkus.container-image.group=projectopenubl \
-Dquarkus.container-image.name=searchpe-${{ matrix.flavor }} \
-Dquarkus.container-image.name=searchpe \
-Dquarkus.container-image.tag=latest \
-P native,ui,${{ matrix.flavor }}
-P native,ui
- name: Save container image
run: docker save -o searchpe-${{ matrix.flavor }}-container-image.tar quay.io/projectopenubl/searchpe-${{ matrix.flavor }}:latest
run: docker save -o searchpe-container-image.tar quay.io/projectopenubl/searchpe:latest
- name: Upload container image
uses: actions/upload-artifact@v3
with:
name: artifacts
path: searchpe-${{ matrix.flavor }}-container-image.tar
path: searchpe-container-image.tar

snapshots:
needs: [ build-snapshot-container ]
Expand All @@ -78,24 +75,12 @@ jobs:
- name: Load and config images
run: |
# Load images from .tar
docker load -i artifacts/searchpe-standalone-container-image.tar
docker load -i artifacts/searchpe-enterprise-container-image.tar
docker load -i artifacts/searchpe-container-image.tar
# Tag images
docker tag quay.io/projectopenubl/searchpe-standalone:latest quay.io/projectopenubl/searchpe:early-access
docker tag quay.io/projectopenubl/searchpe-enterprise:latest quay.io/projectopenubl/searchpe-standalone:early-access
docker tag quay.io/projectopenubl/searchpe-enterprise:latest quay.io/projectopenubl/searchpe-enterprise:early-access
docker tag quay.io/projectopenubl/searchpe-standalone:latest ghcr.io/project-openubl/searchpe/searchpe:early-access
docker tag quay.io/projectopenubl/searchpe-enterprise:latest ghcr.io/project-openubl/searchpe/searchpe-standalone:early-access
docker tag quay.io/projectopenubl/searchpe-enterprise:latest ghcr.io/project-openubl/searchpe/searchpe-enterprise:early-access
docker tag quay.io/projectopenubl/searchpe:latest quay.io/projectopenubl/searchpe:early-access
docker tag quay.io/projectopenubl/searchpe:latest ghcr.io/project-openubl/searchpe/searchpe:early-access
- name: Push images to registry
run: |
docker push quay.io/projectopenubl/searchpe:early-access
docker push quay.io/projectopenubl/searchpe-standalone:early-access
docker push quay.io/projectopenubl/searchpe-enterprise:early-access
docker push ghcr.io/project-openubl/searchpe/searchpe:early-access
docker push ghcr.io/project-openubl/searchpe/searchpe-standalone:early-access
docker push ghcr.io/project-openubl/searchpe/searchpe-enterprise:early-access
docker push quay.io/projectopenubl/searchpe:early-access
docker push ghcr.io/project-openubl/searchpe/searchpe:early-access
52 changes: 47 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,62 @@ services:
timeout: 5s
retries: 5

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.0
environment:
discovery.type: single-node
network_mode: "host"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:9200" ]
interval: 10s
timeout: 5s
retries: 5

keycloak:
image: quay.io/keycloak/keycloak:15.0.2
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin
KEYCLOAK_IMPORT: /tmp/openubl-realm.json
DB_VENDOR: h2
volumes:
- ./src/main/resources/openubl-realm.json:/tmp/openubl-realm.json:z
command:
- "-Djboss.bind.address.private=127.0.0.1"
- "-Djboss.bind.address=0.0.0.0"
network_mode: "host"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/auth" ]
interval: 10s
timeout: 5s
retries: 5

searchpe:
image: quay.io/projectopenubl/searchpe:early-access
ports:
- 8180:8080
image: quay.io/projectopenubl/searchpe:latest
environment:
QUARKUS_HTTP_PORT: 8080
QUARKUS_HTTP_PORT: 8180
QUARKUS_DATASOURCE_USERNAME: db_username
QUARKUS_DATASOURCE_PASSWORD: db_password
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://postgresql:5432/searchpe_db
QUARKUS_DATASOURCE_JDBC_URL: jdbc:postgresql://localhost:5432/searchpe_db
QUARKUS_OIDC_AUTH_SERVER_URL: http://localhost:8080/auth/realms/openubl
QUARKUS_OIDC_CLIENT_ID: searchpe
QUARKUS_OIDC_CREDENTIALS_SECRET: secret
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_USERNAME: any
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_PASSWORD: any
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_PROTOCOL: HTTP
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_HOSTS: localhost:9200
QUARKUS_HIBERNATE_SEARCH_ORM_ELASTICSEARCH_VERSION: 7
QUARKUS_PROFILE: "prod"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/q/health" ]
interval: 10s
timeout: 5s
retries: 5
network_mode: "host"
depends_on:
postgresql:
condition: service_healthy
keycloak:
condition: service_healthy
elasticsearch:
condition: service_healthy
Loading

0 comments on commit b0ad96b

Please sign in to comment.