CLI Reference
Complete command-line interface reference for Gokku.
Installation
Client (Local Machine)
curl -fsSL https://gokku-vm.com/install | bash -s -- --clientServer
curl -fsSL https://gokku-vm.com/install | bash -s -- --serverGlobal Options
-a, --app <app-name>- Specify app name (e.g.,api-production,vad-staging)--version, -v- Show version information--help, -h- Show help information
The -a/--app flag uses your git remote name:
- Must be a configured git remote
- Gokku runs
git remote get-url <name>to extract connection info - Environment is parsed from the remote name suffix
How it works:
You add a git remote (standard git command):
bashgokku remote add api-production ubuntu@server:api gokku remote add vad-staging ubuntu@server:vadGokku parses the remote URL to extract:
- SSH host:
ubuntu@server - App name:
api(from/repos/api.git)
- SSH host:
You use the app name directly:
bashgokku config set PORT=8080 -a api-production gokku logs -a vad-staging -f
Commands
Remote Management
gokku remote setup <user@host> [-i|--identity <pem_file>]
Perform one-time server setup. Installs Gokku, essential plugins, and configures SSH.
gokku remote setup ubuntu@192.168.105.3
gokku remote setup ubuntu@ec2.example.com -i ~/.ssh/my-key.pemgokku remote add <app_name> <user@server_ip>
Add a new git remote.
gokku remote add api-production ubuntu@54.233.138.116gokku remote list
List all configured remotes.
gokku remote listgokku remote remove <remote_name>
Remove a git remote.
gokku remote remove api-productionApplication Management
gokku apps list
List applications on the server.
gokku apps list -a api-productiongokku apps create <app>
Create a new application.
gokku apps create myapp -a myappgokku apps destroy <app>
Destroy an application.
gokku apps destroy myapp -a myappConfiguration
gokku config set KEY=VALUE [-a <app>]
Set environment variables.
# Remote execution
gokku config set PORT=8080 -a api-production
gokku config set DATABASE_URL="postgres://..." -a api-production
# Local execution (on server)
gokku config set PORT=8080 --app apigokku config get KEY [-a <app>]
Get environment variable value.
gokku config get PORT -a api-productiongokku config list [-a <app>]
List all environment variables.
gokku config list -a api-productiongokku config unset KEY [-a <app>]
Remove environment variable.
gokku config unset PORT -a api-productionExecution
gokku run <command> [-a <app>]
Run arbitrary commands inside the application container.
# Remote execution (inside container)
gokku run bundle exec rails console -a api-production
gokku run npm install -a myapp
gokku run python manage.py shell -a django-app
# Local execution (on server, inside container)
gokku run bundle exec rails console --app apiSecurity Note: Commands are executed inside the application's Docker container (named after the app), not directly on the server. This provides isolation and security.
Container Naming: The container name matches the application name (e.g., stt, api-production).
Logs
gokku logs [-a <app>] [-f]
View application logs.
# Remote execution
gokku logs -a api-production -f
gokku logs -a api-production
# Local execution (on server)
gokku logs api production -fStatus
gokku status [-a <app>]
Check service status.
# Remote execution
gokku status -a api-production
# Local execution (on server)
gokku statusRestart
gokku restart [-a <app>]
Restart services.
# Remote execution
gokku restart -a api-production
# Local execution (on server)
gokku restart apiDeployment
gokku deploy [-a <app>]
Deploy applications.
# Remote execution
gokku deploy -a api-production
# Local execution (on server)
gokku deploy apiRollback
gokku rollback [-a <app>] [release-id]
Rollback to previous release.
# Remote execution
gokku rollback -a api-production
gokku rollback -a api-production 2
# Local execution (on server)
gokku rollback api productionExamples
Basic Workflow
# 1. Add remote
gokku remote add api-production ubuntu@54.233.138.116
# 2. Set environment variables
gokku config set PORT=8080 -a api-production
gokku config set DATABASE_URL="postgres://..." -a api-production
# 3. Deploy application
gokku deploy -a api-production
# 4. Check status
gokku status -a api-production
# 5. View logs
gokku logs -a api-production -fRails Application
# Connect to Rails console (inside container)
gokku run bundle exec rails console -a api-production
# Run database migrations (inside container)
gokku run bundle exec rails db:migrate -a api-production
# Check application status
gokku status -a api-productionNode.js Application
# Install dependencies (inside container)
gokku run npm install -a myapp
# Run build process (inside container)
gokku run npm run build -a myapp
# Check logs
gokku logs -a myapp -fPython/Django Application
# Connect to Django shell (inside container)
gokku run python manage.py shell -a django-app
# Run migrations (inside container)
gokku run python manage.py migrate -a django-app
# Install Python packages (inside container)
gokku run pip install requests -a django-appEnvironment Variables
Gokku supports environment-specific configuration:
# Set production environment variables
gokku config set NODE_ENV=production -a api-production
# Set staging environment variables
gokku config set NODE_ENV=staging -a api-stagingTroubleshooting
Common Issues
Remote not found: Make sure the git remote exists
bashgit remote -vPermission denied: Check SSH key configuration
bashssh -T ubuntu@your-serverApp not found: Verify the app exists on the server
bashgokku apps list -a your-app
Next Steps
- Configuration Reference - Config file docs
- Getting Started Guide - Quick start tutorial
- Examples - Real-world usage examples