Skip to content

mackee/template-tanukistack

Repository files navigation

Template of tanukistack

What is tanukistack?

Tanukistack is a template for the development of web application. This contains the following components:

How to use

Requirements

  • gonew command
$ go install golang.org/x/tools/cmd/gonew@latest

Create a new project

$ gonew github.com/mackee/template-tanukistack path/to/your/module ./your_directory
$ cd path/to/your/project
$ aqua i

Settings

.env file is required to run the application. Create a .env file in the root directory of the project and write the following contents.

$ echo 'DATABASE_DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable"' > .env

Run the application

$ task dev

Run the test

$ task test

Use with devcontainer

A devcontainer setup is provided so you can develop without installing Go, task, or PostgreSQL on the host.

Requirements

  • Docker
  • devcontainer CLI
    $ brew install --cask devcontainer
    # or: npm install -g @devcontainers/cli

Usage

$ task dc:up                       # build & start the container (first run takes a while)
$ task dc:exec -- task test        # run tests against the postgres sidecar
$ task dc:exec -- task dev         # run the dev server (forwarded to host :8080)
$ task dc:shell                    # open a shell inside the container
$ task dc:down                     # stop & remove containers (volumes are kept)

Notes

  • DATABASE_DSN is set in containerEnv to point at the bundled postgres sidecar, so a host .env is not required.
  • aqua-managed tools (go, task) are installed on postCreate and cached in a named volume.
  • The postgres data volume (pgdata) is preserved across dc:down / dc:up.

License

MIT

About

A project template for the development of web application in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages