A little introduction here...
- Golang 1.21 or higher
- Openssl3
- To install project run
make
. #- It will create two new files in the project root, called: ".env" and "config.yaml" #- Fill it with correct values to procceed with development
- To run project execute
make run
into the terminal. It will start the API and serve the requests connected to the resources filled in the config files.
- To run and perform test cases, run the following command:
make test
. It will begin the tests execution.
The deploy is performed using some GCP services.
-
Register service account and principal on Innovation IAM with the correct permissions.
Obs.: Use the correct Innovation IAM Backoffice accordingly to the destiny environment.
-
Upload all necessary files to right folder in Bucket such as
private.pem
andinnovation.json
(download it in Innovation IAM Backoffice). -
Map all environment variables in
.env.example
and provide them in "docker build" step oncloudbuild.yaml
. -
Check if
Dockerfile
is receiving all arguments provided in "docker build" step oncloudbuild.yaml
. -
Map all configuration variables in
config.example.yaml
and add them to the Secret Manager.Obs.: All variables should be prefixed with the project name, to prevent conflict with other projects. Example: db_string turns into
project_name
_db_string. -
Create a trigger in Cloud Build pointing to the project repository, prefer to use the second gen Source.
- Add all the substitution variables provided in
cloudbuild.yaml
.
- Add all the substitution variables provided in
-
Check if worker pool is created in Cloud Build.
-
Check if repository is created in Google Artifact Registry.
-
If it's not configured to run automatically when a commit is made to develop or main, run the trigger by commit hash or branch.
While CI/CD is running pay attention if the specified files will be copied and if all the necessary migrations will run.
Method | Content-Type |
---|---|
POST | application/json |
GET | |
OPTIONS |
Variable | Possible Values | Description |
---|---|---|
ENVIRONMENT | local, staging, production | Environment where deployment is working |
USE_SECRETMANAGER | true,false,"" | Decide to use or not Google Cloud Secret Manager |
INNOVATION_CREDENTIALS | path to credentials.json | Indico IAM Credentials file to integrate with authorization and authentication functionalities |
SEC_PREFIX | desirable prefix | Prefix to use inside Secret Manager |
AUTH_SERVER | iam auth server uri | IAM Auth Server URI |
INSECURE | true,false,"" | Use IAM Server in insecure mode |
USE_TLS | true,false,"" | Use HTTPS connections |
PREFORK | true,false,"" | Use prefork threads |
.
├── adapters
│ ├── database
│ │ └── database.go
│ ├── logging
│ │ └── logging.go
│ ├── storage
│ │ └── storage.go
│ └── totp
│ └── totp.go
├── app
│ ├── errors
│ │ └── errors.go
│ ├── repository
│ │ └── .gitkeep
│ └── usecases
│ └── .gitkeep
├── clients
│ ├── google
│ │ ├── logging
│ │ │ └── logging.go
│ │ └── storage
│ │ └── storage.go
│ ├── iam
│ │ └── client.go
│ └── postgres
│ └── postgres.go
├── config
│ ├── constants
│ │ └── constants.go
│ └── config.go
├── entity
│ ├── http_response.go
│ └── log.go
├── handler
│ └── health
│ └── health.go
├── middleware
│ ├── auth.go
│ ├── content.go
│ └── security.go
├── pkg
│ ├── app
│ │ └── app.go
│ ├── crypt
│ │ └── crypt.go
│ ├── helpers
│ │ ├── http.go
│ │ ├── json.go
│ │ └── utils.go
│ └── jwt
│ └── jwt.go
├── .dockerignore
├── .env.example
├── .gitignore
├── .innovation_env
├── config.example.yaml
├── Dockerfile
├── go.mod
├── go.sum
├── main.go
├── README.md
└── route.go