π How to Deploy
Introduction
Welcome to the deployment guide for [OS2-PROJECTNAME]. This document will walk you through the process of deploying pre-built containers, whether youβre setting up a development environment or deploying to a production cluster.
π» Development
To set up a containerized development and test environment on a local computer or in a hosted developer enviroment like GitHub codespaces, you can use a simple docker run
or podman run
command to pull the containerimage and run the container.
Docker example
docker run -d -p {CONTAINERPORT:HOSTPORT} --name {CONTAINER_NAME} {IMAGE_NAME}:{TAG}
Official documentation for docker run
Podman example
podman run -d -p {HOSTPORT}:{CONTAINERPORT} --name {CONTAINER_NAME} {IMAGE_NAME}:{TAG}
Official documentation for podman run
π’ Production
To make deployment of [OS2-PROJECTNAME] simple, fast and standardized, we recommend using the supplied deployment templates in the https://github.com/{USERNAME}/{REPOSITORY}.git
deployment repository.
π₯ Deployment on a single host
For less demanding production environments on a single VM or bare metal host, you can use tools like Ansible, Chef, or Puppet to deploy the containerimage.
Examples
Below is examples that can be run either manually or automated with your Configuration Managment tool of choice. The examples expects the correct enviroment variables to exist and acces to the repository ressources.
Ansible
Example using ssh
and ansible-pull
that pulls and runs the default local.yml
ansible playbook from the https://github.com/{USERNAME}/{REPOSITORY}.git
repository.
ssh remote_user@remote_host "ansible-pull -U https://github.com/{USERNAME}/{REPOSITORY}.git
π Official documentation for ansible-pull
π Cluster Deployment
For more demanding production environments that require scalability, fault tolerance, enchanced security, observability and high availability it is best practice to deploy [OS2-PROJECTNAME] to a cluster controlled by a container orchestrator with technologies like like Kubernetes, Nomad or OpenShift together with GitOps tools like ArgoCD, Flux or Fleet
The deployment templates provided in the https://github.com/{USERNAME}/{REPOSITORY}.git
deployment repository are designed for integration into a version-controlled GitOps workflow. These templates are compatible with your chosen GitOps tools and the container orchestrator of your choice.
π What is GitOps? β | β π An illustrated guide to GitOps
π GitOps Process
Deploy [OS2-PROJECTNAME] to your cluster in 3 steps:
- Initialize and Synchronize:
- Clone the Deployment Templates: Start by cloning the deployment templates from
https://github.com/{USERNAME}/{REPOSITORY}.git
. - Create a New Branch: Establish a new branch for your modifications to preserve the integrity of the main branch.
- Clone the Deployment Templates: Start by cloning the deployment templates from
- Customize and Collaborate:
- Customize the Templates: Tailor the templates to fit your environment and requirements.
- Open a Pull Request (PR): Submit a PR for your branch, enabling peer review and collaboration.
- Merge and Deploy:
- Review and Approve: Have your team review and approve the PR.
- Merge and Trigger: Merge the approved PR into the main branch, which triggers the GitOps tool to synchronize and apply the configurations to your cluster.
βοΈ Managed GitOps Hosting
If preferred, select a managed GitOps hosting provider that aligns with your projectβs needs and goals.