marco-cloud-wallet

0.0.14 • Public • Published

Marco Cloud Wallet

Environment Variables Configuration

View required variables on .env.example

Secure Build

Create KMS Keys to encrypt sensitive files and variables and configure it to be available at build by cloudbuild.yaml

gcloud kms keyrings create finboot-marco-prod  --location=global --project=finboot-kms-resources
gcloud kms keys create finboot-marco-cloud-wallet-cloudbuild-secrets --location=global --keyring=finboot-marco-prod --purpose=encryption --project=finboot-kms-resources
gcloud kms keys add-iam-policy-binding finboot-marco-cloud-wallet-cloudbuild-secrets --location=global --keyring=finboot-marco-prod --member=serviceAccount:274913361067@cloudbuild.gserviceaccount.com --role=roles/cloudkms.cryptoKeyEncrypterDecrypter --project=finboot-kms-resources

Encrypt NPM Token

gcloud kms encrypt \
  --plaintext-file=.npmtoken \
  --ciphertext-file=.npmtoken-prod.enc \
  --location=global \
  --keyring=finboot-marco-prod \
  --key=finboot-marco-cloud-wallet-cloudbuild-secrets \
  --project=finboot-kms-resources

Build project

npm install yarn -g
npm run presetup
npm run setup
npm start build

Docker Image Deployment

Build Docker Image

export NPM_TOKEN=$(cat .npmtoken)
 
sudo docker run --name test-db -e MYSQL_DATABASE=mysql-db -e MYSQL_USER=user -e MYSQL_PASSWORD=password -e MYSQL_ROOT_PASSWORD=toor -p 3306:3306 -d mysql:5.7
sudo docker build --network host --build-arg NPM_TOKEN=$NPM_TOKEN -t finboot/marco-cloud-wallet .
sudo docker tag finboot/marco-cloud-wallet eu.gcr.io/marco-prod/marco-cloud-wallet:latest
sudo gcloud docker -- push eu.gcr.io/marco-prod/marco-cloud-wallet:latest
sudo docker rm -f test-db

Migrations

Generate migrations from src

ts-node ./node_modules/typeorm/cli.js migrations:generate

Note: ./node_modules/typeorm/cli.js is the project local binary of typeorm.

Run generated migrations

npm start db.migrate

Revert database

npm start db.revert

Drop database

npm start db.drop

Seeding Database

npm start db.seed

Development

The server address will be displayed to you as http://0.0.0.0:8080.

cp .env.example .env

Start DB with Docker:

docker-compose up -d

Start Application:

npm start serve

Tests

  • Run the unit tests using npm start test.unit.
  • Run the integration tests using npm start test.integration.
  • Run the e2e tests using npm start test.e2e.

Docker Launch

Create .env file from .env.example and configure it.

cp .env.example .env

Build Docker Image

docker build -t finboot/marco-resource-deployer .

Stat App with Docker

docker run --name explorer-app --env-file .env -d finboot/marco-resource-deployer

/marco-cloud-wallet/

    Package Sidebar

    Install

    npm i marco-cloud-wallet

    Weekly Downloads

    1

    Version

    0.0.14

    License

    none

    Unpacked Size

    571 kB

    Total Files

    136

    Last publish

    Collaborators

    • lopezm94