Go4lage logo

Go4lage Documentation

Setup


Go4lage comes as native go app that is recommend for development, and as a docker-compose package, that is supposed to be your production setup. Of course you can also test your production setup locally.

Choose your preferred setup method below:

All Native for Development


Prerequisites

These are the prerequisites for native, heavy development:

Install Git using the following command:

$ apt install git -y

Install Go by following the instructions at:

https://go.dev/doc/install

Install SQLC using the following command:

$ go install github.com/kyleconroy/sqlc/cmd/sqlc@v1.16.0

Install and set up PostgreSQL using the following commands:

$ apt install postgresql postgresql-contrib -y
      $ service postgresql start
      $ su - postgres
      $ createuser --interactive --pwprompt go4lage
      $ createdb go4lage
      $ psql -c "GRANT ALL PRIVILEGES ON DATABASE go4lage TO go4lage;"
      $ exit

Setup Steps

  1. Clone this repo.
  2. Navigate to the SQL package and generate SQL Queries with sqlc.
  3. Copy the native environment settings to the .env file.
  4. Adjust the .env file to your needs.
  5. Set up the PostgreSQL database and user.
  6. Build the application.
  7. Migrate your database.
  8. Create your superuser.
  9. Start the server.
  10. Visit the documentation at http://localhost:8080/
  11. Visit the admin dashboard at http://localhost:8080/admin

Quick Setup Script

#!/bin/bash
git clone https://github.com/Karl1b/go4lage.git
cd go4lage/pkg/sql
sqlc generate
cd ../..
cp nativeenv.env .env
go build 
./go4lage rungoose up
./go4lage createsuperuser
./go4lage startserver

Congratulations, you've set up a native high-performance web service in less than 5 minutes 😊.

We recommend using the same database for production and development. With go4lage, it's really simple to do. You can use ./go4lage rungoose down to roll back one migration at a time(!) and up vice versa for all migrations. There's no need for a development-only SQLite database that you delete and recreate over and over.

Variant with Docker (Compose) for Production


Prerequisites

These are the prerequisites for your Docker or production setup:

Install Git using the following command:

$ apt install git -y

Note: Git is optional. You need a way to copy the files to your server, whether you use git, ssh copy, or rsync.

Install Docker by following the instructions at:

https://www.docker.com/

Install Docker Compose by following the instructions at:

https://docs.docker.com/compose/install/

Setup Steps

  1. Clone this repo.
  2. Copy the Docker environment settings to the .env file.
  3. Adjust the .env file to your needs.
  4. Start the Docker Compose network.
  5. Hack inside the container and create your superuser.
  6. Visit the documentation at http://localhost:8080/
  7. Visit the admin dashboard at http://localhost:8080/admin

Quick Setup Script

#!/bin/bash
git clone https://github.com/Karl1b/go4lage.git
cd go4lage
cp dockerenv.env .env
docker-compose up -d
docker exec -it docu_app /app/go4lage createsuperuser

Congratulations, you've set up a high-performance dockerized web service in less than 2 minutes 😊.

We recommend finishing the setup by running a native NGINX instance as the main reverse proxy.