Skip to content

delete docker compose (we moved it to infra/local) and update readme … #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ FINGERPRINT_API_URL=https://api.fpjs.io/
STRING_INTERNAL_ID=00000000-0000-0000-0000-000000000000
STRING_WALLET_ID=00000000-0000-0000-0000-000000000001
STRING_BANK_ID=00000000-0000-0000-0000-000000000002
STRING_PLACEHOLDER_PLATFORM_ID=00000000-0000-0000-0000-000000000003
STRING_PLACEHOLDER_PLATFORM_ID=00000000-0000-0000-0000-000000000003
SERVICE_NAME=string_api
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
### For Live Reloading: ###
1. install [Air|https://github.com/cosmtrek/air]: `go install github.com/cosmtrek/air@latest`
2. run `air`
3. if you get `zsh: command not found: air` you need to add to PATH: `PATH=$PATH:$(go env GOPATH)/bin`
### To run the APIS: ###
1. Ensure you have the infra repo where the docker compose file is now located
2. run `docker compose -f ../infra/local/docker-compose.yml up`
3. You can also run with the -d flag to keep the process in the background, ie `docker compose -f -d ../infra/local/docker-compose.yml up`

### For migrations: ###
1. install [Goose|https://pressly.github.io/] `brew install goose`
2. Note, this binary is separate from the go package.
3. `goose postgres "host=localhost dbname=string_db user=string_db password=string_password sslmode=disable" down-to 0`
### To get a live terminal output from any repository being run by the infra docker compose: ###
1. Run `docker logs [docker container name] -f`
2. ie `docker logs platform-admin-api -f`
3. You can get the container names using `docker ps`
4. If you don't want the output in real time, you can omit the `-f` flag

### Postgres & Redis - Docker Compose: ***local dev only*** ###
1. To build and start the docker containers for the first time: `docker-compose up --build`
2. To shutdown the docker containers press `ctl + c`
### For migrations: ###
1. This is now handled by the docker compose file

### Docker Issues?
1. If docker is giving you an error when you try to `docker-compose up --build` try the following commands in order:
Expand All @@ -25,8 +25,10 @@ run `go install` to get dependencies installed

### For local testing: ###
run `go test`
or if you want to run a specific test, use `go test -run [TestName] [./path/to/dir] -v -count 1`
ie `go test -run TestGetSwapPayload ./pkg/service -v -count 1`

### Unit21: ###
This is a 3rd party service that offers the ability to evaluate risk at a transaction level and identify fraud. A client file exists to connect to their API. Documentation is here: https://docs.unit21.ai/reference/entities-api
You can create a test API key on the Unit21 dashboard. You will need to be setup as an Admin. Here are the instructions: https://docs.unit21.ai/reference/generate-api-keys
When setting up the production env variables, their URL will be: https://api.unit21.com/v1
When setting up the production env variables, their URL will be: https://api.unit21.com/v1
3 changes: 1 addition & 2 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ ADD go.mod go.sum /string_api/
RUN go mod download

# install the air tool
RUN curl -fLo install.sh https://raw.githubusercontent.com/cosmtrek/air/master/install.sh \
&& chmod +x install.sh && sh install.sh && cp ./bin/air /bin/air
RUN go install github.com/cosmtrek/air@latest

# install goose for db migrations
RUN go install github.com/pressly/goose/v3/cmd/goose@latest
Expand Down
51 changes: 0 additions & 51 deletions docker-compose.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ALTER TABLE platform
DROP COLUMN IF EXISTS authentication,
ADD COLUMN activated_at TIMESTAMP WITH TIME ZONE DEFAULT NULL, -- for activating prod users
ADD COLUMN name TEXT NOT NULL,
ADD COLUMN description TEXT NOT NULL,
ADD COLUMN description TEXT DEFAULT '',
ADD COLUMN domains TEXT[] DEFAULT NULL, -- define which domains can make calls to API (web-to-API)
ADD COLUMN ip_addresses TEXT[] DEFAULT NULL; -- define which API ips can make calls (API-to-API)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CREATE TABLE platform_member (
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
deactivated_at TIMESTAMP WITH TIME ZONE DEFAULT NULL,
email TEXT NOT NULL,
password TEXT NOT NULL -- how do we maintain this?
password TEXT DEFAULT '' -- how do we maintain this?
);

-------------------------------------------------------------------------
Expand Down