- docker
- kind
- kubectl
- kustomize
- psql
https://www.conventionalcommits.org/en/v1.0.0/
We need postgis for our postgres.
If not using Apple M1 chip or you want to build your own pg, please run the following command, make sure to change the image name if needed and update the image name under container section in zarf/k8s/dev/database/dev-database.yaml
to use your own image.
make service-db
else if you are using Apple M1 chip and does not want to change anything, get docker image for postgres
docker pull vincent0426/tuber-postgres
- create k8s cluster with Kind
make dev-up
- create docker image
make all
- load images built in step 2 to Kind container
make dev-load
- apply all k8s config
make dev-apply
for main service
make dev-port-forward
curl localhost:3000/v1/ping
for chat service
make dev-chat-port-forward
curl localhost:3002/v1/chat/ping
-
Create a gcp project and create a OAuth 2.0 credentials, then update the
AUTH_AUDIENCE
(your oauth cliend id, something like....apps.googleusercontent.com) inzarf/k8s/dev/tuber/dev-tuber-patch-deploy.yaml
-
go to https://developers.google.com/oauthplayground/ and click the gear icon on the top right corner, check the box
Use your own OAuth credentials
and fill in theOAuth Client ID
andOAuth Client secret
from step 1, then clickClose
-
click
Step 1: Select & authorize APIs
and selectGoogle OAuth2 API v2
, and check the boxprofile
andemail
, then clickAuthorize APIs
-
click
Step 2: Exchange authorization code for tokens
and clickExchange authorization code for tokens
, then you will get theid_token
-
use the
id_token
as header (id_token=<your_id_token>) toPOST /v1/auth/login
endpoint, you will be set with cookie automatically and you can access the protected endpoint now
make dev-update
make dev-update-apply
make db-migrations-up
make db-migrations-down
make db-seed-up
make db-seed-down
[Caution!]
routes with header token can not be tested in swagger, you need to use postman or curl and set the cookie to token=<your_token>
to test those routes, this feature is not supported by swagger yet.
after you port-forward, go to http://localhost:3000/v1/docs/index.html
to check swagger
make dev-down # delete k8s cluster
make dev-delete # delete all k8s config, but not delete k8s cluster
make dev-status # check k8s cluster status
make dev-logs # check k8s cluster logs
make dev-chat-logs # check chat service logs
make pgcli # connect to postgres database if you have pgcli installed