Setup
Go4lage is designed to run with Docker Compose, simplifying both development and production environments.
For development, we recommend using a native binary with Docker Compose for database management. This way you do not need to setup a native database on your system.
For testing on your local machine, you can run everything through Docker Compose.
For production deployment on your server, use the full Docker Compose configuration.
Select your preferred setup method below:
Native Go binary 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/installInstall SQLC using the following command:
$ go install github.com/kyleconroy/sqlc/cmd/sqlc@v1.16.0
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
- Clone this repo.
- Navigate to the SQL package and generate SQL Queries with sqlc.
- Copy the native environment settings to the .env file.
- Adjust the .env file to your needs.
- Build the application.
- Make the dev script executable
- Start the db inside docker with a port open for the native binary
- Migrate your database.
- Create your superuser.
- Start the server.
- Visit the documentation at http://localhost:8080/
- 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
sudo chmod +x dev.sh
./dev.sh up -d
./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
- Clone this repo.
- Copy the Docker environment settings to the .env file.
- Adjust the .env file to your needs.
- Start the Docker Compose network.
- Hack inside the container and create your superuser.
- Visit the documentation at http://localhost:8080/
- 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 bash
./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.