Kawaii shop is a mini REST API e-commerce project that made by Golang
If you don't want to use Google Cloud, you don't need to use Gcloud CLI, Google Cloud Run, Google Cloud SQL, Google Cloud Storage, Google Cloud Container Registry, but you need to edit some code.
- Docker
- Vscode
- DBeaver
- Postman
- Gcloud CLI
- Google Cloud Run
- Google Cloud SQL
- Google Cloud Storage
- Google Cloud Container Regitry
go get github.com/gofiber/fiber/v2
go get github.com/joho/godotenv
go get github.com/jmoiron/sqlx
go get github.com/jackc/pgx/v5
go get github.com/golang-jwt/jwt/v5
go get github.com/google/uuid
go get cloud.google.com/go/storage
gcloud auth login
gcloud config set project PROJECT_ID
gcloud config configurations list
docker pull postgres:alpine
docker run --name kawaii_db_test -e POSTGRES_USER=kawaii -e POSTGRES_PASSWORD=123456 -e TZ=Asia/Bangkok -p 4444:5432 -d postgres:alpine
docker exec -it kawaii_db_test bash
psql -U kawaii
CREATE DATABASE kawaii_db_test;
\l
If the migration fails, delete the database and then create a new one and migrate again.
DROP DATABASE kawaii_db_test;
\l
# Migrate up
migrate -source file://path/to/migrations -database 'postgres://kawaii:123456@localhost:4444/kawaii_db_test?sslmode=disable' -verbose up
# Migrate down
migrate -source file://path/to/migrations -database 'postgres://kawaii:123456@localhost:4444/kawaii_db_test?sslmode=disable' -verbose down
docker build -t asia.gcr.io/prject-id/container-bucket .
If an error like this occurs Follow the steps below.
1. open file %userprofile%\.docker\config.json
2. rename credsStore to credStore
Download document.docker push asia.gcr.io/prject-id/container-bucket
1. Choose database
2. Choose Edit
3. Choose Flags
4. ADD A DATABASE FLAG
5. Choose "timezone" variable
6. Set the variable to Asia/Bangkok.