Files
tasknote/tools/tools.md
T
rmcamposandGitHub cc0a9c3de1 feat: Add Brazilian Portuguese and Spanish languages (#132)
* feat: add languages - wip

issue #90

based on article https://dev.to/franklin030601/building-a-multi-language-app-with-react-js-2och

* feat: translate landing, login and register pages

issue #90

* feat: translate all the external texts and messages

issue #90

* feat: add new automations scripts and remove old ones

* feat: add server build info on actuator health page

* feat: language handling for all external pages

issue #90

* feat: start translation at the home page - wip

issue #90

* feat: improve automation to run services on docker

* feat: more automations for the client this time

* feat: translate finished for the home page

issue #90

* feat: translate about page, header and footer

issue #90

* feat: translate task page

issue #90

* feat: translate notes

issue #90

* feat: increase token expiration to one week

* test: fix test cases

* ci: remove client docker image from workflow

* feat: improve reliability

* chore: reduce duplications

* feat: fix lint issues

thansk to https://dev.to/aolyang/eslint-9-flat-config-tutorial-2bm5

* fix: path when login or register
2024-11-01 15:25:57 -03:00

2.2 KiB

Tools

All kind of tools and useful links and commands can be found here!

Building locally

Client - Frontend Web App:

Before building, you need define some env vars:

export VITE_BUILD=<branch-name-and-PR-number>

Then you can call the install and build scripts (from the client folder):

npm ci --ignore-scripts --no-update-notifier --omit=dev \
 && npm run build \
 && rm -rf node_modules

That's it!

Server - Backend REST API:

For the backend there's a Dockerfile ready, just run (from the project root):

docker build -t server ./server

That's it!

Deploying manually

  1. Connect into the server via SSH
  2. Run deploy scripts

Here are a few steps:

export SERVER_IP=
export SERVER_ADDRRESS=

npm ci --ignore-scripts --no-update-notifier --omit=dev
export VITE_BACKEND_SERVER=$SERVER_ADDRRESS/server
npm run build
zip -r "client_$VERSION.zip" dist/
scp "client_$VERSION.zip" root@$SERVER_IP:/root/

Runing with Docker

DB:

docker run -d --rm \
  --name db \
  --network=host \
  -e POSTGRES_DB=$POSTGRES_DB \
  -e POSTGRES_USER=$POSTGRES_USER \
  -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
  -e PGDATA=/tmp \
  -v ./data:/tmp \
  postgres:15.8-bookworm

Server:

docker run -d --rm \
  --name server \
  --network=host \
  -e POSTGRES_DB=$POSTGRES_DB \
  -e POSTGRES_USER=$POSTGRES_USER \
  -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
  -e POSTGRES_PORT=$POSTGRES_PORT \
  -e POSTGRES_HOST=$POSTGRES_HOST \
  -e CORS_ALLOWED_ORIGINS=$CORS_ALLOWED_ORIGINS \
  ghcr.io/ricardo-campos-org/react-typescript-todolist/server:<PR-Number>

Client:

The frontend app will run on Nginx.

Interacting with GitHub Package and Container Registry

Login in:

export CR_PAT=YOUR_TOKEN
echo $CR_PAT | docker login ghcr.io -u RMCampos --password-stdin

Pulling images:

docker pull ghcr.io/ricardo-campos-org/react-typescript-todolist/client:50
docker pull ghcr.io/ricardo-campos-org/react-typescript-todolist/server:50
  • Get container IP docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' db