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/installInstall 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
- 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.
- Set up the PostgreSQL database and user.
- Build the application.
- 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
./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 /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.