-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hngprojects:dev' into fix/add-hng-test-route-for-backends
- Loading branch information
Showing
20 changed files
with
588 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build and Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: docker/development/Dockerfile | ||
push: true | ||
tags: hngdevops/nextjs-boilerplate:dev |
2 changes: 1 addition & 1 deletion
2
.github/workflows/ci-build-lint-test.yml → .github/workflows/build-lint-test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CI Build, Lint, and Test | ||
name: Build, Lint and Test | ||
|
||
on: | ||
pull_request | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,122 @@ | ||
name: Team Deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- team-deploy | ||
paths-ignore: | ||
- .github/workflows/** | ||
workflow_run: | ||
workflows: ["Build and Push"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
team_deployment: | ||
kimiko-golang: | ||
if: github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
environment: [kimiko, cyborgs, starlight] | ||
|
||
environment: | ||
name: ${{ matrix.environment }} | ||
url: ${{ secrets.URL }} | ||
name: "kimiko-golang" | ||
url: ${{ vars.URL }} | ||
|
||
steps: | ||
- name: Deploy to ${{ matrix.environment }} environment | ||
- name: Deploy to kimiko-golang environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
./deploy_${{ matrix.environment }}.sh | ||
cd hng_boilerplate_nextjs | ||
./scripts/team_deploy.sh kimiko-golang ${{ vars.PORT }} | ||
cyborgs-java: | ||
if: github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: "cyborgs-java" | ||
url: ${{ vars.URL }} | ||
|
||
steps: | ||
- name: Deploy to cyborgs-java environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
cd hng_boilerplate_nextjs | ||
./scripts/team_deploy.sh cyborgs-java ${{ vars.PORT }} | ||
cyborgs-python: | ||
if: github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: "cyborgs-python" | ||
url: ${{ vars.URL }} | ||
|
||
steps: | ||
- name: Deploy to cyborgs-python environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
cd hng_boilerplate_nextjs | ||
./scripts/team_deploy.sh cyborgs-python ${{ vars.PORT }} | ||
bulldozer-php: | ||
if: github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: "bulldozer-php" | ||
url: ${{ vars.URL }} | ||
|
||
steps: | ||
- name: Deploy to bulldozer-php environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
cd hng_boilerplate_nextjs | ||
./scripts/team_deploy.sh bulldozer-php ${{ vars.PORT }} | ||
starlight-nestjs: | ||
if: github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: "starlight-nestjs" | ||
url: ${{ vars.URL }} | ||
|
||
steps: | ||
- name: Deploy to starlight-nestjs environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
cd hng_boilerplate_nextjs | ||
./scripts/team_deploy.sh starlight-nestjs ${{ vars.PORT }} | ||
panther-expressjs: | ||
if: github.event.repository.fork == false | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: "panther-expressjs" | ||
url: ${{ vars.URL }} | ||
|
||
steps: | ||
- name: Deploy to panther-expressjs environment | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ${{ secrets.USERNAME }} | ||
password: ${{ secrets.PASSWORD }} | ||
script: | | ||
cd hng_boilerplate_nextjs | ||
./scripts/team_deploy.sh panther-expressjs ${{ vars.PORT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Security Policy | ||
|
||
Security is very important for this project and its community. 🔒 | ||
|
||
Learn more about it below. 👇 | ||
|
||
## Versions | ||
|
||
The latest version or release is supported. | ||
|
||
You are encouraged to write tests for your application and update your versions frequently after ensuring that your tests are passing. This way you will benefit from the latest features, bug fixes, and **security fixes**. | ||
|
||
## Reporting a Vulnerability | ||
|
||
If you think you found a vulnerability, and even if you are not sure about it, please report it right away by sending an email to: [email protected]. Please try to be as explicit as possible, describing all the steps and example code to reproduce the security issue. | ||
|
||
The maintainers will review it thoroughly and get back to you. | ||
|
||
## Public Discussions | ||
|
||
Please refrain from publicly discussing a potential security vulnerability. 🙊 | ||
|
||
It's better to discuss privately and try to find a solution first, to limit the potential impact as much as possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 {next|remix}" | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" == "next" ]; then | ||
cd /home/nextjs/dev/hng_boilerplate_nextjs | ||
git pull origin dev | ||
docker compose -f docker/development/docker-compose.yml build | ||
docker compose -f docker/development/docker-compose.yml up -d | ||
elif [ "$1" == "remix" ]; then | ||
cd /home/remixjs/dev/hng_boilerplate_remix | ||
git pull origin dev | ||
docker compose -f docker/development/docker-compose.yml build | ||
docker compose -f docker/development/docker-compose.yml up -d | ||
else | ||
echo "Invalid argument. Use 'next' or 'remix'." | ||
echo "Usage: $0 {next|remix}" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 {next|remix}" | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" == "next" ]; then | ||
cd /home/nextjs/prod/hng_boilerplate_nextjs | ||
git pull origin main | ||
docker compose -f docker/prod/docker-compose.yml build | ||
docker compose -f docker/prod/docker-compose.yml up -d | ||
elif [ "$1" == "remix" ]; then | ||
cd /home/remixjs/prod/hng_boilerplate_remix | ||
git pull origin main | ||
docker compose -f docker/prod/docker-compose.yml build | ||
docker compose -f docker/prod/docker-compose.yml up -d | ||
else | ||
echo "Invalid argument. Use 'next' or 'remix'." | ||
echo "Usage: $0 {next|remix}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 {next|remix}" | ||
exit 1 | ||
fi | ||
|
||
if [ "$1" == "next" ]; then | ||
cd /home/nextjs/staging/hng_boilerplate_nextjs | ||
git pull origin staging | ||
docker compose -f docker/staging/docker-compose.yml build | ||
docker compose -f docker/staging/docker-compose.yml up -d | ||
elif [ "$1" == "remix" ]; then | ||
cd /home/remixjs/staging/hng_boilerplate_remix | ||
git pull origin staging | ||
docker compose -f docker/staging/docker-compose.yml build | ||
docker compose -f docker/staging/docker-compose.yml up -d | ||
else | ||
echo "Invalid argument. Use 'next' or 'remix'." | ||
echo "Usage: $0 {next|remix}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Check if the team name is provided | ||
if [ -z "$1" ]; then | ||
echo "Error: Team name is required." | ||
echo "Usage: $0 [team name] [port]" | ||
exit 1 | ||
fi | ||
|
||
# Check if the port is provided | ||
if [ -z "$2" ]; then | ||
echo "Error: Port number is required." | ||
echo "Usage: $0 [team name] [port]" | ||
exit 1 | ||
fi | ||
|
||
# Assign arguments to variables for clarity | ||
TEAM_NAME=$1 | ||
PORT=$2 | ||
|
||
git pull origin dev | ||
docker pull hngdevops/nextjs-boilerplate:dev | ||
docker stop $TEAM_NAME || true | ||
docker rm $TEAM_NAME -f || true | ||
docker run -d --name "$TEAM_NAME" -p "$PORT:3000" hngdevops/nextjs-boilerplate:dev |
Oops, something went wrong.