Skip to content

Installation

This guide covers setting up and running the ImLate server.

Prerequisites

ToolVersionNotes
Docker20.10+With Docker Compose v2 (recommended setup)
Go1.25+Only needed for local (non-Docker) setup
MakeanyThin wrapper around Docker scripts
MySQL clientoptionalFor direct database access

Docker Compose starts MySQL 8 and the Go application with hot-reload.

1

Clone the repository:

bash
git clone git@github.com:buzyka/imlate.git
cd imlate
2

Create the environment file. Copy the example and set AUTH_TOKEN_SECRET (minimum 32 characters):

bash
cp docker/.env.docker.example .env

Edit .env and set a secure value for AUTH_TOKEN_SECRET.

3

Start the environment:

bash
make start

This runs docker compose up, waits for MySQL to be healthy, applies database migrations automatically, and starts the application.

4

Verify the setup:

bash
curl http://localhost:8080/ping
# {"message":"pong"}

Docker Compose Topology

The development environment runs two containers:

ServiceContainerHost PortDescription
appimlate-app8080Go application with source mounted
mysqlimlate-mysql3307MySQL 8.0 with persistent data volume

MySQL creates a tracker database with user trackme/trackme on first start.

Option 2: Local Setup (Without Docker)

Requires a running MySQL 8 instance with a tracker database.

1

Set environment variables (or create a .env file in the project root):

bash
export DATABASE_HOST=127.0.0.1
export DATABASE_PORT=3306
export DATABASE_USERNAME=trackme
export DATABASE_PASSWORD=trackme
export DATABASE_NAME=tracker
export AUTH_TOKEN_SECRET="your-secret-at-least-32-characters-long"
2

Install dependencies and run:

bash
go mod download
go run cmd/app/main.go

Migrations are applied automatically on startup.

Verification

Once the application is running on port 8080:

URLDescription
http://localhost:8080/pingHealth check — returns {"message":"pong"}
http://localhost:8080/swagger/index.htmlInteractive Swagger UI for the API
http://localhost:8080/adminAdmin Panel (Vue SPA)
http://localhost:8080/RFID Reader terminal UI
isb.buzyka.com
Swagger UI
Swagger UI — interactive API documentation at /swagger/index.html

Default Users

The database migration seeds two default users:

UsernameRolePurpose
adminadminDefault admin account for the Admin Panel
terminalterminalDefault terminal device account

WARNING

Change the default passwords in production. They are set as bcrypt hashes in the migration and should be replaced with strong credentials.

Useful Commands

CommandDescription
make startStart Docker environment (MySQL + app)
make stopStop Docker environment
make restartRestart everything
make restart-appRestart only the app container
make logs-appTail application logs
make shellOpen bash in the app container
make mysql-shellOpen MySQL CLI
make gotRun all tests
make gotcRun tests with coverage
make golRun linter
make swagRegenerate Swagger docs
make migrate-upApply pending database migrations
make migrate-downRoll back last migration
make migrate-create name=...Create a new migration pair
make distBuild distributable binary

Database Migrations

Migrations live in the migrations/ directory and use golang-migrate.

Auto-Migration

The application runs MigrateUp automatically on every startup. If all migrations are already applied, this is a no-op. Deploying a new version with new migrations automatically updates the schema.

Manual Migration

bash
make migrate-up                        # Apply pending migrations
make migrate-down                      # Roll back the last migration
make migrate-create name=add-feature   # Create new up/down migration files

Production Build

Build a distributable binary:

bash
make dist

The production Docker image uses a multi-stage build: Go compilation in a builder stage, then a minimal Debian runtime image with only the binary, migrations, and static assets.