Getting Started
Server Setup
Prerequisites:
- A Debian/Ubuntu server with SSH access (root or sudo user)
Installation
Remote Setup (Windows/macOS)
Install the CLI and run setup remotely:
Windows:
irm https://raw.githubusercontent.com/Shawiizz/dockflow/main/install.ps1 | iex
dockflow setup remotemacOS:
curl -fsSL https://raw.githubusercontent.com/Shawiizz/dockflow/main/install.sh | bash
dockflow setup remoteThe CLI will prompt you to connect to your Linux server via SSH. You can provide:
- SSH host, port, username, and password/key
- Or an existing Dockflow connection string
Interactive Setup (Recommended)
dockflow setupThe interactive wizard will guide you through:
- Checking required dependencies (Ansible, SSH)
- Creating a deployment user with sudo privileges
- Configuring SSH key authentication
- Installing Docker and initializing Swarm mode
- Optionally installing Portainer for container management
- Generating a connection string for CI/CD
Non-Interactive Setup (Linux only)
For automated provisioning, Terraform, or CI environments (must be run directly on the target host):
dockflow setup auto \
--host $(hostname -I | awk '{print $1}') \
--user dockflow \
--password "your-secure-password" \
--generate-key \
--portainer \
--portainer-password "portainer-admin-password"Available options:
| Option | Description | Default |
|---|---|---|
--host | Public IP/hostname for connection string | Required |
--port | SSH port | 22 |
--user | Deployment username | dockflow |
--password | User password (for new user or sudo) | Required |
--ssh-key | Path to existing SSH private key | - |
--generate-key | Generate a new SSH key | false |
--skip-docker-install | Skip Docker installation | false |
--portainer | Install Portainer | false |
--portainer-port | Portainer HTTP port | 9000 |
--portainer-password | Portainer admin password | - |
--portainer-domain | Portainer domain name | - |
See dockflow setup auto --help for the complete list.
Create Project Structure
Create the following structure:
- config.yml
- servers.yml
- docker-compose.yml
- Dockerfile.[service]
Notes:
servers.ymldefines your servers and environment variableshooks/andtemplates/folders are optional
Copy CI Config File
GitHub users in organizations: Fork the dockflow repoĀ and update the uses URL in your workflow file.
GitHub Actions
Create .github/workflows/deploy.yml:
name: Github CI/CD
on:
push:
branches:
- '*'
tags:
- '*'
# Note: Make sure your .deployment/config.yml has project_name set:
# project_name: "my-app"
jobs:
# Basic CI job to run on every push to branches (not used for deployment)
build:
if: github.ref_type == 'branch'
uses: Shawiizz/dockflow/.github/workflows/[email protected]
with:
free-disk-space: false # Set to true if you need to free disk space during build (for big docker images)
# Deploy your application on tag push
deploy-tag:
if: github.ref_type == 'tag'
uses: Shawiizz/dockflow/.github/workflows/[email protected]
with:
tag: ${{ github.ref_name }}
free-disk-space: false # Set to true if you need to free disk space during deployment (for big docker images)
secrets: inherit
# Deploy your application on push to branch
deploy-branch:
if: github.ref_type == 'branch'
uses: Shawiizz/dockflow/.github/workflows/[email protected]
with:
version: ${{ github.ref_name }}-${{ github.sha }} # Note: the variable is called "version" specifically for branch deployments
free-disk-space: false # Set to true if you need to free disk space during deployment (for big docker images)
secrets: inheritAdd Repository Secrets
Configure secrets in your CI/CD settings:
Recommended
Using Connection String (Easiest)
| Secret Name | Description | Example |
|---|---|---|
[ENV]_[SERVERNAME]_CONNECTION | All-in-one connection string per server | PRODUCTION_MAIN_SERVER_CONNECTION |
GIT_TOKEN | OPTIONAL: For remote build option | GitHub/GitLab token |
The connection string is automatically generated by the CLI during server setup. It contains all necessary connection details (Host, Port, User, Private Key, Password).
Do not share connection strings - they contain sensitive credentials including SSH private keys.
Server names in servers.yml use underscores in CI secrets. A server named main_server uses MAIN_SERVER in secrets.
Dynamic Variable Override System:
Any CI secret starting with [ENV]_ or [ENV]_[SERVERNAME]_ will automatically override corresponding environment variables defined in your servers.yml.