RocketMainta documentation

Deployment

1. Build

git clone <repository> rocketmainta && cd rocketmainta
go build -trimpath -ldflags "-s -w" -o /usr/local/bin/rocketmainta ./cmd/server

The binary is self-contained; the only runtime requirements are the binary, the MySQL/MariaDB server and the web/ directory (templates and static assets) next to it.

# deploy the assets
rsync -a web/ /opt/rocketmainta/web/

2. Database

CREATE DATABASE rocketmainta CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'rocket'@'127.0.0.1' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON rocketmainta.* TO 'rocket'@'127.0.0.1';
FLUSH PRIVILEGES;

The application creates the database and applies the schema itself, but granting the rights up front avoids surprises.

3. Environment

cat > /etc/rocketmainta.env <<'ENV'
APP_NAME=RocketMainta
APP_URL=https://repair.example.com
APP_ENV=production
APP_DEBUG=false
APP_PORT=8080

DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=rocket
DB_PASSWORD=a-long-random-password
DB_DATABASE=rocketmainta

JWT_SECRET=$(openssl rand -hex 32)
JWT_TTL_HOURS=72
COOKIE_SECURE=true
SESSION_COOKIE=rm_session

SUPER_ADMIN_EMAIL=you@example.com
SUPER_ADMIN_PASSWORD=a-strong-password

MAIL_FROM=no-reply@example.com
MAIL_FROM_NAME="RocketMainta"
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=...
SMTP_PASS=...
SMTP_STARTTLS=true

CURRENCY=USD
TAX_PERCENT=0
ENV

chmod 600 /etc/rocketmainta.env
SUPER_ADMIN_EMAIL / SUPER_ADMIN_PASSWORD are only used when the users table has no administrator yet. Set them before the first start, then change the password in the admin panel.

4. systemd

# /etc/systemd/system/rocketmainta.service
[Unit]
Description=RocketMainta service centre platform
After=network-online.target mysql.service mariadb.service
Wants=network-online.target

[Service]
Type=simple
User=rocketmainta
Group=rocketmainta
WorkingDirectory=/opt/rocketmainta
EnvironmentFile=/etc/rocketmainta.env
ExecStart=/usr/local/bin/rocketmainta
Restart=always
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ReadWritePaths=/opt/rocketmainta/storage

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now rocketmainta
journalctl -u rocketmainta -f

5. Reverse proxy (nginx)

server {
    listen 80;
    server_name repair.example.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name repair.example.com;

    ssl_certificate     /etc/letsencrypt/live/repair.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/repair.example.com/privkey.pem;

    client_max_body_size 12M;

    location / {
        proxy_pass         http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_read_timeout 60s;
    }
}
The application uses c.IP() for the audit log and the login throttle. Behind a proxy, set app.ProxyHeader in internal/app/routes.go to X-Forwarded-For (or enable Fiber's EnableTrustedProxyCheck) so the real client IP is recorded.

6. First steps after the deployment

  1. Sign in with the seeded administrator.
  2. Admin → Appearance: set the logo, the favicon and the brand colours.
  3. Admin → Settings → general: the company details, the address, the currency and the tax rate.
  4. Admin → Payment gateways: add the credentials of the gateways you want to accept, then test

the connection.

  1. Admin → SMTP / notifications: check that the mail relay works, then review the 20

notification rules.

  1. Admin → Languages: activate the languages you serve and edit the translations.
  2. Admin → Services / categories: replace the demo catalogue with your own.

7. Backups

# database
mysqldump --single-transaction --routines --triggers rocketmainta | gzip > rocketmainta-$(date +%F).sql.gz

# uploads
tar czf uploads-$(date +%F).tar.gz -C /opt/rocketmainta storage

A nightly cron job plus an off-site copy is enough:

15 3 * * * mysqldump --single-transaction rocketmainta | gzip > /var/backups/rm-$(date +\%F).sql.gz
30 3 * * * find /var/backups -name 'rm-*.sql.gz' -mtime +14 -delete

8. Upgrades

cd /opt/rocketmainta
git pull
go build -trimpath -ldflags "-s -w" -o /usr/local/bin/rocketmainta ./cmd/server
systemctl restart rocketmainta

The schema is idempotent: the new binary applies the missing statements on the next start and leaves the existing data untouched.

9. Health checks

curl -fsS https://repair.example.com/health
# {"ok":true,"status":"ok","version":"1.0.0", …}

Use /health for the load-balancer probe and /api/v1/admin/reports/status (staff token) for a deeper check.