Add following to your /etc/hosts
before executing make up
(workaround to issue #493)
127.0.0.1 registry.local
*.local.trapti.tech
, local.trapti.tech
which points to 127.0.0.1
are used during development.
Accessing wildcard domains when running under WSL environment may require configuring Windows C:\Windows\System32\drivers\etc\hosts
file like following.
127.0.0.1 ns.local.trapti.tech
::1 ns.local.trapti.tech localhost
Recommended dev environment is docker compose. k3d environment is mainly for testing k8s features.
You will need /Makefile
and /compose.yaml
at the project root.
make init
: Install / update development toolsmake up
: Spin up development environmentmake down
: Tear down development environment
Everything should automatically start after running make up
.
- Dashboard: http://ns.local.trapti.tech/
- For more, type
make
to display all commands help
If you use Docker Desktop for Windows and WSL2...
- (recommended) install and use Docker on WSL2 instead of Docker Desktop
- (workaround) run
chmod o+rw /var/run/docker.sock
You will need manifest files in /.local-manifest
directory.
make init
(at project root): Install / update development toolsmake up
(at/.local-manifest
): Spin up development environmentmake down
(at/.local-manifest
): Tear down development environment- The use of k3d (k3s in docker) allows ease cleanup.
Everything should automatically start after running make up
.
For more, see .local-manifest/README.md.
Run tests with make test
.
See Makefile for more.
To change the database schema, do the following:
- Change schema in
./migrations/schema.sql
. This definition file is the source of truth for all generated tables / codes. - Run
make migrate
to apply schema changes to local db container in an idempotent manner. - Run
make gen
(or individually,make gen-go && make gen-db-docs
) to update generated codes and docs via SQLBoiler and tbls. - Write your code.
- Don't forget to modify fields in
./pkg/domain
structs,./pkg/infrastructure/repository/repoconvert
functions, etc.
- Don't forget to modify fields in
To change the API schema, do the following:
- Change schema in
./api/proto/neoshowcase/protobuf/*.proto
files. These files are the source of truth for all generated codes. - Run
make gen
(or individually,make gen-proto
) to generate both server (Go) and client (TypeScript) codes. - Write your code.
- Don't forget to modify fields in
./pkg/infrastructure/grpc/pbconvert
etc.
- Don't forget to modify fields in
To add a new internal component, we are using github.com/google/wire.
Example: A new repository in ./pkg/infrastructure/repository
, a new use-case service in ./pkg/usecase
etc.
- Write a new component.
- Add its constructor method (
New...()
) to./cmd/providers.go
.- Reference the component from needed component. Example: add the component as a member in
Server
struct in./cmd/controller/server.go
. See./cmd/wire.go
to see how each component references multiple internal components.
- Reference the component from needed component. Example: add the component as a member in
- Add config and its default to
./cmd/config.go
, if necessary. - Run
make gen
(or individually,make gen-go
) to generate DI (dependency injection) codes.