Deploy docker containers using GitOps approach
If you were searching for the tool like ArgoCD to implement GitOps pattern for Docker containers - you are on the right place.
Simplecontainer enables the GitOps approach to deploying containers on single or cluster of docker daemon hosts with simplecontainer enabled nodes.
This allows to pull the latest changes on the definitions from the git repository instead of pushing the changes to the node via CLI.
To checkout gitops deployment - first, you need to have simplecontainer running and CLI configured already. If you didn't do that you need to do that first.

Afterward, clone the examples repository and list the definitions inside the directories.
git clone https://github.com/simplecontainer/examples
GitOps manual sync for simplecontainer
An example definition of the GitOps object is given below.
kind: gitops
meta:
group: examples
name: plain-manual
spec:
repoURL: "https://github.com/simplecontainer/examples"
revision: "main"
directoryPath: "/tests/minimal"
examples/tests/gitops-apps/gitops-plain.yaml
Applying this object: examples/tests/gitops-apps/gitops-manual.yaml
simplecontainer willl create an GitOps object on the node and will reconcile all definitions specified under the directoryPath on the revision of the git repository.
smrctl apply examples/tests/gitops-apps/definitions/gitops-plain.yaml
object proposed for apply: gitops
smrctl ps gitops
RESOURCE REVISION SYNCED AUTO SYNC STATUS
──────────────────────────────────────────────────────────────────────────
gitops/examples/plain-manual main Never synced false drifted
A GitOps object can do auto sync and manual sync. Since the sync is manual in this case we need to trigger the sync manually via CLI.
smrctl gitops sync gitops/examples/plain-manual
smrctl ps
NODE RESOURCE PORTS IMAGE STATE ENGINE STATE SMR STATE
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
smr-development-node-1 containers/example/example-busybox-1 - pulled running (docker) running (14s)
sc ps gitops
RESOURCE REVISION SYNCED AUTO SYNC STATUS
────────────────────────────────────────────────────────────────────
gitops/examples/plain-manual main 64f879e false insync
sc gitops repositories
RESOURCE REPOSITORY COMMIT REVISION
──────────────────────────────────────────────────────────────────────────────────────────────
gitops/examples/plain-manual https://github.com/simplecontainer/examples 64f879e main
sc gitops definitions gitops/examples/plain-manual
RESOURCE DEFINITIONS DRIFTED LAST SYNC
──────────────────────────────────────────────────────────────────────────────
gitops/examples/plain-manual containers/example/busybox InSync 1m15s
Simplecontainer will pick up definitions from the definition.yaml and will reconcile the state - create containers on the node.
GitOps auto sync for simplecontainer
kind: gitops
meta:
group: examples
name: plain-auto
spec:
repoURL: "https://github.com/simplecontainer/examples"
revision: "main"
automaticSync: true
directoryPath: "/tests/minimal"
examples/tests/gitops-apps/gitops-automatic.yaml
After applying this object it will auto-sync changes.
GitOps App of apps pattern for simplecontainer
kind: gitops
meta:
group: examples
name: app-of-apps
spec:
repoURL: "https://github.com/simplecontainer/examples"
revision: "main"
directoryPath: "tests/gitops-apps"
tests/gitops/app-of-apps.yaml
Using this pattern we can create one GitOps object that will automate creation and syncing of new GitOps objects.
smrctl apply examples/tests/gitops-app-of-apps.yaml
object proposed for apply: gitops
smrctl ps gitops
RESOURCE REVISION SYNCED AUTO SYNC STATUS
─────────────────────────────────────────────────────────────────────────────────────────────
gitops/examples/app-of-apps main 64f879e true insync
gitops/examples/plain-auto main 64f879e true insync
gitops/examples/plain-manual-spread main Never synced false definitions_invalid
gitops/examples/plain-manual main Never synced false drifted
smrctl ps
NODE RESOURCE PORTS IMAGE STATE ENGINE STATE SMR STATE
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
smr-development-node-1 containers/example/example-busybox-1 - pulled running (docker) running (41s)
As you can see, after syncing app-of-apps
GitOps object will generate the rest of the GitOps objects from /tests/gitops/apps
the directory.
Using the dashboard we can investigate in real time what is happening to the GitOps objects and what they hold inside. For this example in particular, the output would be similar to the one in the video below.