Getting Started
Server Setup
Prerequisites:
- A Debian/Ubuntu server with SSH access
One-Line Installation (Recommended)
curl -fsSL "https://raw.githubusercontent.com/Shawiizz/dockflow/main/cli/cli_wrapper.sh?$(date +%s)" | bashThe CLI will guide you through:
- Configuring this server
- Creating a deployment user
- Configuring SSH keys
- Installing Docker and Portainer (optional)
Alternative: Use Docker image
If you prefer using Docker:
docker run -it --rm -v ${HOME}/.ssh:/root/.ssh -v .:/project shawiizz/dockflow-cli:latestCI/CD Configuration
Create Project Structure
You can use the CLI to automatically generate the project structure:
# GitHub Actions project
docker run -it --rm -v .:/project shawiizz/dockflow-cli:latest init github
# GitLab CI project
docker run -it --rm -v .:/project shawiizz/dockflow-cli:latest init gitlabThis creates the following structure:
.deployment/
βββ docker/
β βββ docker-compose.yml # Define your services
β βββ Dockerfile.[service] # One per service
βββ env/ # OPTIONAL: Can use CI secrets instead
β βββ .env.[environment] # OPTIONAL: Environment variables
βββ templates/
βββ nginx/ # Custom Nginx configs (optional)
βββ services/ # Custom systemd services (optional)
βββ scripts/ # Custom scripts (optional)Copy CI Config File
GitHub Actions:
example/ci/github-ci.yml β .github/workflows/deploy.ymlGitLab CI:
example/ci/gitlab-ci.yml β .gitlab-ci.ymlβ οΈ GitHub users in organizations: Fork this repo and update the
usesURL in your workflow file.
Add Repository Secrets
Required secrets in your CI/CD settings:
| Secret Name | Description | Example |
|---|---|---|
[ENV]_CONNECTION | Recommended: All-in-one connection string (Host, User, Key, Password) generated by the CLI | PRODUCTION_CONNECTION |
[ENV]_SSH_PRIVATE_KEY | Alternative: SSH key for main host | PRODUCTION_SSH_PRIVATE_KEY |
[ENV]_[HOSTNAME]_SSH_PRIVATE_KEY | Alternative: SSH key for specific host | PRODUCTION_SERVER_A_SSH_PRIVATE_KEY |
GIT_TOKEN | OPTIONAL: Remote build option | GitHub/GitLab token |
Note: The [ENV]_CONNECTION secret is automatically generated by the CLI during server setup. It contains all necessary connection details (Host, Port, User, Private Key, Password).
Dynamic Variable Override System:
Any CI secret starting with [ENV]_ or [ENV]_[HOSTNAME]_ will automatically override corresponding environment variables.