self-deployment
v1.0.6
Published
A fly.io-inspired deploy tool for self-managed SSH servers
Downloads
748
Readme
self-deployment
A fly.io-inspired deploy tool for self-managed SSH servers. Build Docker images locally and deploy them to your own VPS/servers via SSH.
Installation
npm install -g self-deploymentOr install locally:
npm install self-deploymentQuick Start
Initialize a project:
self-deploy initEdit
deploy.tomlwith your server configuration.Build and deploy:
self-deploy build self-deploy deploy
Configuration (deploy.toml)
app = "my-app"
registry = "localhost:5000"
[build]
dockerfile = "Dockerfile"
context = "."
buildArgs = { NODE_ENV = "production" }
[[servers]]
name = "prod-1"
host = "192.168.1.10"
port = 22
user = "ubuntu"
password = "your-password-here"
[[servers]]
name = "prod-2"
host = "192.168.1.11"
port = 22
user = "ubuntu"
privateKey = "~/.ssh/id_rsa"
[deploy]
image = "my-app:latest"
port = 3000
restartPolicy = "unless-stopped"
env = { NODE_ENV = "production" }Required Fields
app- Application name[[servers]]- At least one server configuration[deploy]section with:image- Docker image nameport- Port to expose
Server Options
Each server requires:
name- Server identifier (e.g., "prod-1")host- IP address or hostnameport- SSH port (default: 22)user- SSH username- Either
passwordorprivateKeyfor authentication
Commands
self-deploy init
Creates a sample deploy.toml in the current directory.
self-deploy build
Builds the Docker image locally using the configuration in deploy.toml.
self-deploy build # Uses deploy.toml
self-deploy build -c custom.toml # Custom configself-deploy push
Pushes the built image to a Docker registry.
self-deploy push # Push to registry in configself-deploy deploy
Deploys the application to all configured SSH servers.
self-deploy deploy # Deploy to all servers
self-deploy deploy -s prod-1 # Deploy to specific serverself-deploy status
Shows deployment status on all servers.
self-deploy statusself-deploy logs
Fetches logs from the deployed container.
self-deploy logs # Logs from first server
self-deploy logs -s prod-1 # Logs from specific serverself-deploy stop
Stops the running container on a server.
self-deploy stop # Stop on first server
self-deploy stop -s prod-1 # Stop on specific serverDocker Registry
For local development, you can run a local Docker registry:
docker run -d -p 5000:5000 --name registry registry:2Then set registry = "localhost:5000" in your deploy.toml.
License
MIT
