Writing a Stack File

With a single file in git repo, you can orchestrate an entire application, from the containers to the infrastructure.

To create a stack, you'll first need to add a JSON file with the name cycle.json to the root of your git repository. When you import your stack into Cycle, it will read this file and generate a build, containing all images and configurations needed to deploy your application. By committing this file to your repo, it becomes version tracked, giving you a history of all changes.

Check out our full documentation on stack files here.

An Example Stack

{
"version": "1.0",
"about": null,
"tests": [],
"services": {
"loadbalancer": null,
"vpn": null
},
"containers": {
"db": {
"name": "mysql:5.7",
"image": {
"name": "mysql:5.7",
"source": {
"docker_hub": {
"target": "mysql:5.7",
"username": ""
}
}
},
"config": {
"network": {
"public": "disable",
"hostname": "db",
"ports": [
"3306:3306"
]
},
"deploy": {
"instances": 1,
"constraints": null,
"shutdown": null,
"restart": null,
"health_check": null
},
"runtime": {
"workdir": null,
"command": null,
"environment_vars": {
"MYSQL_DATABASE": "wordpress",
"MYSQL_PASSWORD": "wordpress",
"MYSQL_ROOT_PASSWORD": "somewordpress",
"MYSQL_USER": "wordpress"
},
"namespaces": null,
"capabilities": null,
"privileged": false
},
"scaling": null,
"resources": null,
"integrations": null
},
"volumes": [
{
"local": {
"max_size": "1G"
},
"destination": "/var/lib/mysql",
"read_only": false,
"remote_access": {
"enable": false,
"webhook": "",
"password": null
}
}
]
},
"wordpress": {
"name": "Wordpress",
"image": {
"name": "Wordpress",
"source": {
"docker_hub": {
"target": "cycleplatform/wordpress:latest",
"username": ""
}
}
},
"config": {
"network": {
"public": "enable",
"hostname": "wordpress",
"ports": [
"443:80"
]
},
"deploy": {
"instances": 1,
"constraints": null,
"shutdown": null,
"restart": null,
"health_check": null
},
"runtime": {
"workdir": null,
"command": null,
"environment_vars": {
"WORDPRESS_DB_HOST": "db:3306",
"WORDPRESS_DB_NAME": "wordpress",
"WORDPRESS_DB_PASSWORD": "wordpress",
"WORDPRESS_DB_USER": "wordpress"
},
"namespaces": null,
"capabilities": null,
"privileged": false
},
"scaling": null,
"resources": null,
"integrations": null
},
"volumes": [
{
"local": {
"max_size": "1G"
},
"destination": "/var/www/html",
"read_only": false,
"remote_access": {
"enable": true,
"webhook": "",
"password": {
"algorithm": "raw",
"data": "yourpassword"
}
}
}
]
}
},
"annotations": {}
}

Finalize

As mentioned at the top of this article, you will need to save your stack to a cycle.json file and commit it up to the root of a git repo. If you wish to test your stack first, you can paste in your raw JSON file into the portal.

Need Help?

If you've got questions about the platform or need some help getting started, our team is more than happy to assist. Whether you're new to containers or just new to Cycle, reach out to us via livechat by clicking the blue circle in the bottom right corner. Join our Slack channel, and get help from the dev team or other members of the community, and check out our Roadmap to see what's planned for the future!