diff --git a/source/user_guide/index.rst b/source/user_guide/index.rst index 1a755aa925b8fb070e840f042aafd76bf735d27c..4e15a6a1009d82b49677dccab5fbbab275d4f371 100644 --- a/source/user_guide/index.rst +++ b/source/user_guide/index.rst @@ -41,6 +41,16 @@ Run on kubernetes + +Run in prod with docker compose +=============================================================================== +.. toctree:: + :maxdepth: 3 + + run_with_compose + + + Frequently Asked Questions ========================== .. toctree:: diff --git a/source/user_guide/run_locally.rst b/source/user_guide/run_locally.rst index f4110a993aaa104f30d9905df689ec1b612ca922..9ae531fe5a9dfd4e29863034e9c82bb96856e2f0 100644 --- a/source/user_guide/run_locally.rst +++ b/source/user_guide/run_locally.rst @@ -166,6 +166,7 @@ One command line is enough. .. note:: | Press :kbd:`Ctrl` + :kbd:`C` to exit +.. _admin_container: Administrate your container ------------------------------ diff --git a/source/user_guide/run_with_compose.rst b/source/user_guide/run_with_compose.rst new file mode 100644 index 0000000000000000000000000000000000000000..dc8e2c19f8c20845315b24ff1a3da1334a09ff90 --- /dev/null +++ b/source/user_guide/run_with_compose.rst @@ -0,0 +1,72 @@ +.. _run_compose: + +Running in production with docker compose +------------------------------------------------- + + +.. note:: + + We consider that you have configure previously a ``Dockerfile`` file according to instructions described in :ref:`Adapting the Dockerfile to your needs section<dockefile>` + + We consider that you have configured the ``.gitlab-ci`` file, and your project is build images at each commit :ref:`according to the Setup the project<project_and_gitlab_ci>` + + We consider that your computer/the server have docker and docker compose installed + + +Although our goal is to empower you to run your application in kubernetes, we here provide guidance on how to run it in production in a virtual machine. +In this section, you will define your settings related to your project, and then be able to run the image built by gitlab after the last commit. + +Run the example +************************************************* +.. code-block:: bash + + docker compose --env-file .example.env up + + +Configure your .env +************************************************* + +In the `.env` file we provide example to run the compose : + +Given a project hosted at # If your project is hosted at https://gitlab.pasteur.fr/ada-team/my-project/ +where the production branch is named `main`, the file is: + +.. code-block:: ini + + CI_PROJECT_NAMESPACE=ada-team + CI_PROJECT_NAME=my-project + CI_REGISTRY=registry-gitlab.pasteur.fr + PROD_BRANCH=main + +Run it +************************************************* + +.. code-block:: bash + + docker compose up -d + +With private registry +************************************************* + +You have to auth before starting the compose. Given a .auth file containing : + +.. code-block:: ini + + DEPLOY_USER=my-user + DEPLOY_TOKEN=not-secured-password + +You should then do: + +.. code-block:: bash + + source .auth + source .env + echo $DEPLOY_TOKEN | docker login --username $DEPLOY_USER $CI_REGISTRY --password-stdin + docker compose up -d + +more info can be found at https://docs.docker.com/reference/cli/docker/login/#password-stdin + +Administrate your container +************************************************* + +Information on how to manage the containers can be found at :ref:`admin_container` \ No newline at end of file diff --git a/source/user_guide/setup_project.rst b/source/user_guide/setup_project.rst index f2010fa90d9619bac3f9ca94ee5a96c4e1979239..bdb0ea72dea37f509f4d63d2d142fb77afa74d77 100644 --- a/source/user_guide/setup_project.rst +++ b/source/user_guide/setup_project.rst @@ -1,3 +1,5 @@ +.. _project_and_gitlab_ci: + Setup the project to run on Kubernetes ===============================================================================