components-db-golang

module
v0.0.0-...-4dd99de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2024 License: MIT

README

Playground in golang-based web frameworks

Preparation

  1. Install Task

  2. Install pre-commit

  3. Install pre-commit hooks, pull docker images and build containers:

    task init
    
  4. Start the application:

    task up
    

The first time you commit you may need to run:

$ GOFLAGS=-buildvcs=false pre-commit

Starting and stopping the application

If starting from scratch:

$ docker compose up --wait

Stream logs:

$ docker compose logs -f backend

Run with latest images and dependencies:

$ docker compose build --pull
$ docker compose up --wait

Open a database shell:

$ docker compose run psql

Run production backend:

$ docker compose --profile production up --build prod-backend

Stopping:

$ docker compose --profile=* down

Stopping and removing local state:

$ docker compose --profile=* down --volumes --remove-orphans

Testing

Running backend tests

$ docker compose run backend-test

Updating database migrations

$ docker compose run atlas-make-migrations

Backend container

Configuration environment variables:

  • DATABASE_DSN - (required) postgres connection string
  • HOST - bind interface. Default: 0.0.0.0
  • POST - bind port. Default: 8000

Directories

Path Synopsis
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL