-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
8,988 additions
and
0 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,44 @@ | ||
name: deploy to the development environment | ||
|
||
on: | ||
push: | ||
branches: [development] | ||
|
||
permissions: | ||
contents: read # for checkout | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: executing remote ssh commands using password | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.LUNA_CD_SSH_HOST }} | ||
username: ${{ secrets.LUNA_CD_SSH_USERNAME }} | ||
key: ${{ secrets.LUNA_CD_SSH_KEY }} | ||
port: ${{ secrets.LUNA_CD_SSH_PORT }} | ||
script_stop: true | ||
script: | | ||
mkdir -p /lunatic/repos; | ||
cd /lunatic/repos; | ||
if [ ! -d luna ]; then | ||
git clone https://github.com/sisgha/luna -b development luna; | ||
fi | ||
cd luna; | ||
cd luna-backend; | ||
make dev-setup; | ||
make dev-down; | ||
git checkout -b temp-fix; | ||
git branch -D development; | ||
git fetch origin; | ||
git checkout -b development; | ||
git pull origin development; | ||
make dev-start; |
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,58 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
/build | ||
|
||
*.env | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# temp directory | ||
.temp | ||
.tmp | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json |
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,5 @@ | ||
**/.git | ||
**/*.env | ||
**/*.env* | ||
**/node_modules | ||
Dockerfile |
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 |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
/node_modules | ||
/build | ||
|
||
*.env | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
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,21 @@ | ||
FROM node:18 as base | ||
RUN apt update -y | ||
RUN apt install -y git | ||
WORKDIR /luna-container/luna-backend | ||
|
||
FROM base as prod-deps | ||
COPY package.json .npmrc package-lock.json ./ | ||
RUN npm install --omit=dev | ||
|
||
FROM prod-deps as dev-deps | ||
RUN npm install | ||
|
||
FROM dev-deps as assets | ||
COPY . . | ||
RUN npm run build | ||
RUN rm -rf node_modules | ||
|
||
FROM prod-deps | ||
COPY --from=assets /luna-container/luna-backend /luna-container/luna-backend | ||
WORKDIR /luna-container/luna-backend | ||
CMD npm run db:migrate && npm run seed:run && npm run start:prod |
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,26 @@ | ||
dev-setup: | ||
|
||
$(shell (cd devops/development; find . -type f -name "*.example" -exec sh -c 'cp -n {} $$(basename {} .example)' \;)) | ||
|
||
$(shell sudo docker network create sisgea-luna-net 2>/dev/null) | ||
|
||
dev-up: | ||
make dev-setup; | ||
sudo docker compose --file devops/development/docker-compose.yml -p sisgea-luna-backend up -d --remove-orphans; | ||
|
||
dev-shell: | ||
make dev-up; | ||
sudo docker compose --file devops/development/docker-compose.yml -p sisgea-luna-backend exec sisgea-luna-backend bash; | ||
|
||
dev-down: | ||
sudo docker compose --file devops/development/docker-compose.yml -p sisgea-luna-backend stop | ||
|
||
dev-logs: | ||
sudo docker compose --file devops/development/docker-compose.yml -p sisgea-luna-backend logs -f | ||
|
||
|
||
dev-start: | ||
make dev-down; | ||
make dev-up; | ||
|
||
sudo docker compose --file devops/development/docker-compose.yml -p sisgea-luna-backend exec -d sisgea-luna-backend bash -c "npm i && npm run start:dev" |
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,3 @@ | ||
POSTGRESQL_DATABASE=main | ||
# POSTGRESQL_USERNAME=postgres | ||
POSTGRESQL_PASSWORD=7f22682363b549a389e03b7fe512488b |
Empty file.
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,36 @@ | ||
services: | ||
sisgea-luna-backend: | ||
image: node:20 | ||
user: node | ||
command: sh -c "tail -f /dev/null" | ||
container_name: sisgea-luna-backend | ||
working_dir: /container/code | ||
depends_on: | ||
- sisgea-luna-backend-db | ||
networks: | ||
- sisgea-luna-net | ||
ports: | ||
- 3000:3000 | ||
volumes: | ||
- ../../../../../libs:/sisgea/env-dev/libs | ||
- ../../:/container/code | ||
env_file: | ||
- .env | ||
|
||
sisgea-luna-backend-db: | ||
image: bitnami/postgresql:15 | ||
container_name: sisgea-luna-backend-db | ||
volumes: | ||
- 'sisgea-luna-backend-db-data:/bitnami/postgresql' | ||
- './volumes/db/scripts/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d' | ||
networks: | ||
- sisgea-luna-net | ||
env_file: | ||
- .db.env | ||
|
||
networks: | ||
sisgea-luna-net: | ||
external: true | ||
|
||
volumes: | ||
sisgea-luna-backend-db-data: |
Oops, something went wrong.