# Automatic deployment to production environment

**URL:** https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471
**Category:** Self-hosting
**Created:** [May 2, 2024, 1:38pm UTC](https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471 "2024-05-02T13:38:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [May 2, 2024, 1:38pm UTC](https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471/1 "2024-05-02T13:38:14Z")

</div>

Hi,  
I have Discourse installed on two separate Azure VMs (staging and production). Is there a way to automatically deploy changes from staging Discourse to production Discourse?

UI changes (theme) will be managed in a Git repository, so shipping them to production won’t be a problem. The main concern lies in automating the deployment of Discourse settings and configurations to the production environment. How can we achieve this?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 2, 2024, 1:59pm UTC](https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471/2 "2024-05-02T13:59:17Z")

</div>

You can push the staging container to a repo and then launch it on production. The `./launcher start-cmd app` will give you the required stuff to crank up the container in Docker.

You’ll also need to migrate the database (perhaps with `SKIP_POST_DEPLOYMENT_MIGRATIONS` and then again when the new container has started if you want true zero downtime) and precompile assets.

Some settings live the the database. Others can be set with ENV variables like `DISCOURSE_SETTING_NAME` (e.g., `DISCOURSE_TITLE='my great communiyt'`)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [May 2, 2024, 2:13pm UTC](https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471/3 "2024-05-02T14:13:56Z")

</div>

A lighter weight strategy is to use this:

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/f/4/0f4e268ce618f44cc5e215622de5a6ffa2478776.png)

Note the “only show overriden” in top right

That will give you a list of things which aren’t default which you might transfer manually.

Depending on your need this might be simpler. (That said, I’ve got 100 + settings that are not default on my several year old instance.)

app.yml can be partially copied.

Of course that won’t carry across Categories etc.

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [May 3, 2024, 9:50am UTC](https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471/4 "2024-05-03T09:50:50Z")

</div>

> [@pfaffman](#):
>
> You can push the staging container to a repo and then launch it on production. The `./launcher start-cmd app` will give you the required stuff to crank up the container in Docker.

Can this be achieved with a standalone approach, or do I need to have two containers (one for the database and one for the web)?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 3, 2024, 11:27am UTC](https://meta.discourse.org/t/automatic-deployment-to-production-environment/306471/5 "2024-05-03T11:27:13Z")

</div>

If you’re not a hobbyist, I recommend two containers, as you have to shut down the database when you start a new container so you can’t have zero downtime. But it would work with a single container.
