Skip to content

Commit

Permalink
Merge pull request #143 from Arquisoft/develop
Browse files Browse the repository at this point in the history
Entregable 2
  • Loading branch information
Pelayori authored Mar 12, 2024
2 parents 2adc0d7 + f7e4a98 commit 6b362a2
Show file tree
Hide file tree
Showing 1,940 changed files with 113,937 additions and 45,917 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/build.yml

This file was deleted.

147 changes: 34 additions & 113 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,128 +1,49 @@
name: Deploy on release

on:
push:
branches:
- java-deployment
release:
types: [published]

jobs:
unit-tests:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm --prefix users/authservice ci
- run: npm --prefix users/userservice ci
- run: npm --prefix gatewayservice ci
- run: npm --prefix webapp ci
- run: npm --prefix users/authservice test -- --coverage
- run: npm --prefix users/userservice test -- --coverage
- run: npm --prefix gatewayservice test -- --coverage
- run: npm --prefix webapp test -- --coverage
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
e2e-tests:
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm --prefix users/authservice install
- run: npm --prefix users/userservice install
- run: npm --prefix gatewayservice install
- run: npm --prefix webapp install
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
env:
API_URI: http://${{ secrets.DEPLOY_HOST }}:8000
with:
name: arquisoft/wiq_es04b/webapp
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
workdir: webapp
buildargs: API_URI
docker-push-authservice:
name: Push auth service Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/wiq_es04b/authservice
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: users/authservice
docker-push-userservice:
name: Push user service Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/wiq_es04b/userservice
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: users/userservice
docker-push-gatewayservice:
name: Push gateway service Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/wiq_es04b/gatewayservice
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: gatewayservice

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/arquisoft/wiq_es04b:latest
no-cache: true

deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp]
needs: build-and-push
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/arquisoft/wiq_es04b/master/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_es04b/master/.env -O .env
docker compose down
docker compose --profile prod up -d
- name: Deploy over SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
script: |
wget https://raw.githubusercontent.com/${{ github.repository }}/${{ github.ref_name }}/docker-compose.yml -O docker-compose.yml
docker-compose down
docker compose pull
docker-compose up -d
96 changes: 95 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,97 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### HSQLDB ###
database/hsqldb/build/
database/hsqldb/data/
database/hsqldb/doc/
database/hsqldb/src/
database/hsqldb/testrun/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
*.lck
node_modules
coverage
docs/build
docs/build
.idea/compiler.xml
.idea/encodings.xml
.idea/jarRepositories.xml
.idea/misc.xml
.idea/vcs.xml
database/hsqldb/build/antivy-setup.xml
database/hsqldb/build/build-dist.gradle
database/hsqldb/build/build-dist.xml
database/hsqldb/build/build-docbook.xml
database/hsqldb/build/build.gradle
database/hsqldb/build/build.hsqldb.cmd
database/hsqldb/build/build.hsqldbtest.cmd
database/hsqldb/build/build.javadoc.cmd
database/hsqldb/build/build.sqltool.cmd
database/hsqldb/build/build.test.suite.cmd
database/hsqldb/build/build.xml
database/hsqldb/build/cfdistro.bash
database/hsqldb/build/clean.test.suite.cmd
database/hsqldb/build/dbuInstallSheetsWrapper.groovy
database/hsqldb/build/dependencies.gradle
database/hsqldb/build/DocBookUtil.groovy
database/hsqldb/build/gradle/wrapper/gradle-wrapper.jar
database/hsqldb/build/gradle/wrapper/gradle-wrapper.properties
database/hsqldb/build/gradlew
database/hsqldb/build/gradlew.bat
database/hsqldb/build/gui-initial.setting
database/hsqldb/build/gui-welcome.txt
database/hsqldb/build/hsqldb.bnd
database/hsqldb/build/ivy.xml
database/hsqldb/build/ivysettings-sample.xml
database/hsqldb/build/jdkcodeswitch.list
database/hsqldb/build/mvn-pub.gradle
database/hsqldb/build/rng-catalog-template.xml
database/hsqldb/build/run.test.suite.cmd
database/hsqldb/build/setenv.cmd
database/hsqldb/build/settings.gradle
database/hsqldb/build/test.dbmd.convert.properties
database/hsqldb/build/test.properties
database/hsqldb/build/test.xml
target/classes/application.properties
target/classes/com/uniovi/controllers/CustomErrorController.class
target/classes/com/uniovi/controllers/HomeController.class
target/classes/com/uniovi/entities/AppUser.class
target/classes/com/uniovi/WiqEs04bApplication.class
target/classes/static/css/custom.css
target/classes/templates/error.html
target/classes/templates/fragments/footer.html
target/classes/templates/fragments/head.html
target/classes/templates/fragments/nav.html
target/classes/templates/index.html
/database/hsqldb/bin/test.log
/database/hsqldb/bin/test.properties
/database/hsqldb/bin/test.script
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Build stage with Maven and JDK 17
FROM maven:3.8.4-openjdk-17-slim as build
WORKDIR /app
COPY pom.xml .
COPY src src/
# Use Maven directly instead of the Maven Wrapper
RUN mvn clean package -DskipTests

# Run stage with JDK 17
FROM openjdk:17-slim
COPY --from=build /app/target/*.jar app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=prod","-jar","/app.jar"]
EXPOSE 443
Loading

0 comments on commit 6b362a2

Please sign in to comment.