module
0.0.0-20240325130042-d1be49876feb
Repository: https://github.com/mkaiho/go-auth-api.git
Documentation: pkg.go.dev
# README
go-auth-api
Description
Repository for sample auth api.
Dev Settings
Set environment variables
- Export environment variables
$ touch .envrc $ echo "dotenv" >> .envrc $ touch .env $ echo "CDK_DEFAULT_ACCOUNT=<YOUR AWS ACCOUNT FOR DEPLOY APPS>" >> .env $ echo "CDK_DEFAULT_REGION=<YOUR AWS REGION FOR DEPLOY APPS>" >> .env $ echo "AWS_VAULT_BACKEND=pass" >> .env $ echo "AWS_VAULT_PASS_PREFIX=aws-vault" >> .env $ echo "AWS_SESSION_TOKEN_TTL=1h" >> .env $ echo "AWS_DEFAULT_REGION=<YOUR AWS DEFAULT REGION>" >> .env $ direnv allow
Install dependencies
```
$ make dev-deps deploy-deps
```
AWS credentials
- Generate GPG key
$ gpg --gen-key
- Initialize password-store
$ pass init <TYPED EMAIL IN GPG GENERATION>
- Register your aws profile
$ aws-vault add <PROFILE NAME> Enter Access Key ID: <YOUR AWS ACCESS KEY> Enter Secret Access Key: <YOUR AWS SECRET ACCESS KEY>
- Check for successful completion
$ aws --profile <PROFILE NAME> s3 ls
Debug
- Visual Studio Code
- Get AWS credential (expires in 1h)
$ AWS_PROFILE=<PROFILE NAME> make cache-credentials
- Select the Debug tab from the Activity Bar on the left side
- Select
auth-api-server
from the pull-down menu at the top of the Side Menu - Click the green triangle icon button to start debugging
- Get AWS credential (expires in 1h)
Deploy and destroy applications
Deploy applications with CDK in AWS
- Build applications
$ make build
- Archive bin files for Lambda
$ make archive
- Deploy applications
$ AWS_PROFILE=<PROFILE NAME> DEPLOY_ENV=<DEPLOY ENV NAME> make deploy
Destroy applications with CDK in AWS
$ AWS_PROFILE=<PROFILE NAME> DEPLOY_ENV=<DEPLOY ENV NAME> make destroy
Connect to DB via ssh tunnel
- Fetch ssh key for bastion
$ AWS_PROFILE=<PROFILE NAME> make fetch-bastion-key
- Open ssh tunnel
$ AWS_PROFILE=<PROFILE NAME> make open-bastion-tunnel
- Connect to DB
$ mysql -u <DB USER> -D <DB NAME> -h 127.0.0.1 -P 3307 -p
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author