Flux is a lightweight self-hosted pseudo-PaaS for hosting Golang web apps with ease. Built on top of Buildpacks and Docker, Flux simplifies the deployment process with a focus on similicity, speed, and reliability.
- Blue-Green Deployments: Deploy new versions of your app without downtime
- Simplify Deployment: Flux takes care of the deployment process, so you can focus on writing your app
- Flexible Configuration: Easily configure your app with
flux.json
- Automatic Container Management: Steamline your app with automatic container management
- Go
- ZQDGR
- Buildpacks (daemon only)
- Docker (daemon only)
To install and start the Flux daemon using ZQDGR, run the following command:
Important
CGO is required to build the daemon due to the use of mattn/go-sqlite3
go install github.com/juls0730/zqdgr@latest
git clone https://github.com/juls0730/flux.git
cd flux
# either
zqdgr build:daemon
sudo ./fluxd
# or
FLUXD_ROOT_DIR=$PWD/fluxdd zqdgr run:daemon
docker run -d --name fluxd --network host -v /var/run/docker.sock:/var/run/docker.sock -v fluxd-data:/var/fluxd -p 5647:5647 -p 7465:7465 zoeissleeping/fluxd:latest
go install github.com/juls0730/zqdgr@latest
git clone https://github.com/juls0730/flux.git
cd flux
zqdgr build:daemon
sudo mv fluxd /usr/local/bin/
cat <<EOF
[Unit]
Description=Flux Daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/fluxd
Restart=always
Environment=GOPATH=/var/fluxd/go
Environment=HOME=/var/fluxd/home
[Install]
WantedBy=multi-user.target
EOF | sudo tee /etc/systemd/system/fluxd.service
sudo systemctl daemon-reload
sudo systemctl enable --now fluxd
Install the CLI using the following command:
go install github.com/juls0730/flux/cmd/flux@latest
Flux daemon looks for a confgiuration file in /var/fluxd/config.json
but can be configured by setting $FLUXD_ROOT_DIR
to the directory where you want all fluxd files to be stored.
{
"builder": "paketobuildpacks/builder-jammy-tiny"
}
builder
: The buildpack builder to use (default:paketobuildpacks/builder-jammy-tiny
)
- Default port: 5647 (Daemon server)
- Reverse Proxy Port: 7465 (configurable via
FLUXD_PROXY_PORT
environment variable)
The CLI looks for a configuration file in ~/.config/flux/config.json
:
{
"daemon_url": "http://127.0.0.1:5647"
}
daemon_url
: The URL of the daemon to connect to (default:http://127.0.0.1:5647
)
Flux <command>
Available commands:
init
: Initialize a new projectdeploy
: Deploy an applicationstart
: Start an applicationstop
: Stop an applicationdelete
: Delete an applicationlist
: View application logs
flux.json is the configuration file in the root of your proejct that defines deployment settings:
{
"name": "my-app",
"url": "myapp.example.com",
"port": 8080,
"env_file": ".env",
"environment": ["DEBUG=true"]
}
name
: The name of the projecturl
: Domain for the applicationport
: Web server's listening portenv_file
: Path to environment variable fileenvironment
: Additional environment variables
- After deploying an app, point your domain to the Flux reverse proxy
- Ensure the Host header is sent with your requests
Found a bug, or have something you think would make Flux better? Submit an issue or pull request.
Flux is licensed with the MIT license