Deploy Agent
Disclaimer: This project is NOT intended for a production evironment. Use at your own risk.
Depoy agent can run on a remote machine to pull and run containers.
Prerequisites
You need to have the latest versions of Go and Docker
Installation
Build an executable:
go build .
Specify IP and PORT in .env using the same format as in the .env.example
or:
cp .env.example .env
Run an agent:
./deploy-agent
Usage:
Create a deployment from a JSON object:
POST /create
curl -XPOST http://localhost:8008/create -d '{
"image": "nginx:latest",
"name": "nginx",
"containerNet": {
"port": "80",
"proto": "tcp"
},
"hostNet": {
"ip": "0.0.0.0",
"portFirst": 8090,
"proto": "tcp"
},
"replicas": 2,
"command": [
"nginx",
"-g",
"daemon off;"
]
}' -u admin:admin
Get running containers:
GET /get
curl -XGET http://localhost:8008/get/nginx -u admin:admin
Update deployment image:
PATCH /update
curl -XPATCH localhost:8008/update -d '{"name":"nginx","image":"nginx:1.21.0"}' -u admin:admin
Stop deployment:
POST /stop
curl -XPOST http://localhost:8008/stop -d '{"name":"nginx"}' -u admin:admin