diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 00000000..3ef4893d --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,53 @@ +name: Build and Deploy Backend + +on: + push: + branches: ['master'] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + defaults: + run: + working-directory: user-backend + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'adopt' + + - name: Build Maven project + run: mvn clean package + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: ./user-backend + file: ./user-backend/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml new file mode 100644 index 00000000..03cd145f --- /dev/null +++ b/.github/workflows/frontend.yml @@ -0,0 +1,56 @@ +name: Build & Deploy frontend + +on: + push: + branches: [ master ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + + GHRC_USERNAME: ${{ secrets.GHRC_USERNAME }} + GHRC_TOKEN: ${{ secrets.GHRC_TOKEN }} + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: user-frontend + permissions: + contents: read + packages: write + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install Dependencies + run: npm install --force + + - name: Build Project + run: npm run build + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: ./user-frontend + file: ./user-frontend/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index c6bb0365..00000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Java CI with Maven - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - name: Build with Maven - run: mvn -B package --file pom.xml - - # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive - - name: Update dependency graph - uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..d53ecaf3 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.compile.nullAnalysis.mode": "automatic", + "java.configuration.updateBuildConfiguration": "automatic" +} \ No newline at end of file diff --git a/k8s-correct/backend-deployment.yaml b/k8s-correct/backend-deployment.yaml new file mode 100644 index 00000000..747975fe --- /dev/null +++ b/k8s-correct/backend-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: user-backend-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: user-backend + template: + metadata: + labels: + app: user-backend + spec: + containers: + - name: user-backend + image: bansikah/user-backend:1.0 + ports: + - containerPort: 8082 +--- +apiVersion: v1 +kind: Service +metadata: + name: user-backend-service +spec: + selector: + app: user-backend + ports: + - protocol: TCP + port: 8082 + targetPort: 8082 + type: ClusterIP \ No newline at end of file diff --git a/k8s-correct/frontend-deployment.yaml b/k8s-correct/frontend-deployment.yaml new file mode 100644 index 00000000..f790539e --- /dev/null +++ b/k8s-correct/frontend-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: user-frontend-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: user-frontend + template: + metadata: + labels: + app: user-frontend + spec: + containers: + - name: user-frontend + image: bansikah/user-frontend:1.0 + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: user-frontend-service +spec: + selector: + app: user-frontend + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: NodePort \ No newline at end of file diff --git a/social-login/HELP.md b/social-login/HELP.md new file mode 100644 index 00000000..d6cfb4eb --- /dev/null +++ b/social-login/HELP.md @@ -0,0 +1,30 @@ +# Read Me First +The following was discovered as part of building this project: + +* The original package name 'com.bansikah.social-login' is invalid and this project uses 'com.bansikah.social_login' instead. + +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/3.3.3/maven-plugin) +* [Create an OCI image](https://docs.spring.io/spring-boot/3.3.3/maven-plugin/build-image.html) +* [Spring Web](https://docs.spring.io/spring-boot/docs/3.3.3/reference/htmlsingle/index.html#web) +* [OAuth2 Client](https://docs.spring.io/spring-boot/docs/3.3.3/reference/htmlsingle/index.html#web.security.oauth2.client) + +### Guides +The following guides illustrate how to use some features concretely: + +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) + +### Maven Parent overrides + +Due to Maven's design, elements are inherited from the parent POM to the project POM. +While most of the inheritance is fine, it also inherits unwanted elements like `` and `` from the parent. +To prevent this, the project POM contains empty overrides for these elements. +If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides. +