Alternately, if you want to run it on a Docker Swarm, first make sure you have a swarm. If you don’t, run:
Once you have your swarm, in this directory run:
The swarm master must have Python installed.
Deploy to Remote Swarm with Codefresh
First you need to setup the following environment variables in your Codefresh pipeline
remote Docker swarm master machine, accessible over SSH (for example, [email protected])
is new Docker stack name (use "vote", for example)
private SSH key, used to access Docker swarm master machine
split character, you’ve used to replace newline in SSH key. Recommendation: use , (comma character).
The SSH_KEY variable has the contents of the SSH key that can access the Docker swarm host. Currently in order to pass SSH key through Codefresh UI, you need to convert it to single line string (replacing newline with comma), like this:
The SPLIT_CHAR variable should hold the replacement character that was used for the SSH key (in the example above it is the comma character)
Deploy to Docker Swarm with a YML step
Once all the variables are set you can use the following freestyle step to deploy to your cluster.
You can also pass custom credentials like this:
Create a CI/CD pipeine for Docker swarm
Here is the full pipeline:
And here is the pipeline definition:
The values of MY_REGISTRY, MY_REGISTRY_USER and MY_REGISTRY_PASSWORD depend upon the type of your connected registry.