# How to deploy !!! info "This is how **we** deploy" This page describes how the main instance is deployed, and is mainly meant as a way to share the knowledge. You can obviously do things differently. ## Services "La chariotte" uses different domains: - **docs.chariotte.fr**, the docs you are reading now. It's handled by [readthedocs.org](https://readthedocs.org). - **chariotte.fr**, the main instance. It's deployed on Alwaysdata - **blog.chariotte.fr**, our blog. It's [a static website](https://gitlab.com/la-chariotte/la-chariotte.gitlab.io) deployed on Gitlab pages. ## The main instance ### Alwaysdata, our hosting provider [Alwaysdata](https://www.alwaysdata.com) offers [a free plan for open source projects](https://www.alwaysdata.com/en/open-source/), which we are using for the main instance of la chariotte. Thanks to them for supporting open source! ### Getting access To get access, you'll need to generate an ssh keypair, and give your public key to a known admin. ```bash ssh-keygen ``` This will generate a private a public key. You need to share the **public** key. On unix systems, it's stored under `~/.ssh/id_rsa.pub` by default. ### Connecting to ssh Once your key is generated and you're known to the server, you can connect there. ```bash ssh chariotte@ssh-chariotte.alwaysdata.net ``` ### Configuration file The chariotte application is run by [uwsgi](https://uwsgi-docs.readthedocs.io/ en/latest/), managed by AlwaysData. The production settings are stored in `~/ la_chariotte/prod_settings.py`, and the secrets are defined in the admin console. ### The different sites In the AD console, here are the defined sites: - `app.chariotte.fr`, redirecting to `chariotte.fr` - `chariotte.fr/static`, hosting the static files, it just serves the collected static files stored in `/static/` - `chariotte.fr`, the main website, defined in the next section `chariotte.fr` is configured as a Python WSGI app: - application path: `/la_chariotte/la_chariotte/wsgi.py` - working directory: `/la_chariotte` - venv location: `/venv` Environment variables: ``` DJANGO_SETTINGS_MODULE=prod_settings ``` ### How to deploy To deploy a new version, we'll need to: - get the new code - update the database - collect the static files - restart the daemon Here's how: ```bash # Activate the venv source venv/bin/activate cd la_chariotte # Get the code git fetch git checkout tag # if we're using a tag, otherwise, just checkout the main branch python manage.py updatedb python manage.py collectstatic ``` Then you'll need to restart the server from AD's interface. ### What about SSL certificates? The SSL certificates are issued directly by AlwaysData (they use [Let's Encrypt] (https://letsencrypt.org/) behind the scenes) ## Mails Mails are hosted by alwaysdata, as part of their opensource plan.