Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aboutlo/casval-gas-station
https://github.com/aboutlo/casval-gas-station
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/aboutlo/casval-gas-station
- Owner: aboutlo
- Created: 2021-03-24T21:40:33.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-29T18:02:47.000Z (over 3 years ago)
- Last Synced: 2024-11-07T20:45:21.968Z (2 months ago)
- Language: TypeScript
- Size: 773 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# README
## Prerequisites
- Intstall https://ngrok.com/download
- `brew install libpq` & `brew link --force libpq` (only for interact with AWS RDS)## Dev mode
docker-compose up
yarn build
yarn start### webhook & ngrok
In order to test in local the webhooks with the mobile app it's useful to expose the local instance via (ngrok)[https://ngrok.com/download]
ngrok http 8080
Then in the `config.ts` file update `rampNetwork.kovan.webhookURL` with the ngrok url e.g. `http://bae108bc8677.ngrok.io/ramp-network`
This will bind the port 8080 to a public port via a proxy.
## Crate a proxy from local to a Google Cloud SQL
Staging
./cloud_sql_proxy -instances=casval-308710:europe-west1:db-staging=tcp:5434
Production
./cloud_sql_proxy -instances=casval-308710:europe-west1:db-prod=tcp:5435
## Add a property to a model
- Open `schema.prisma`
- Add the property in a model e.g `fooId` as `String` in the Order entity or event a whole new entity```
model Order {
fooId String
}
```- Run `yarn db:migrate` this will ask for a migration name and generate all the required files
- Run `yarn db:test:migrate` to apply the changes to the test database too## deploy
- Create a connection to the `Staging` Postgresql `./cloud_sql_proxy -instances=casval-308710:europe-west1:db-staging=tcp:5434`
- Run `yarn db:staging:migrate`
- Commit and push to update the container## Continuous Deployment
### Prerequisites
Install `aws`
```bash
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
```Configure `aws`
aws configure --profile ci
ask for the credentials of `ci`
create a ECR repo (if doesn't exist)
aws ecr create-repository gas-station --profile ci
build the image
docker build -t 345106504809.dkr.ecr.eu-west-1.amazonaws.com/gas-station:latest .
push the image
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 345106504809.dkr.ecr.eu-west-1.amazonaws.com
## restore a db
```bash
psql --host database-stage.cpfuih3je3rv.eu-west-1.rds.amazonaws.com --port 5432 --username postgres --dbname gas-station-staging
```