# Move from standalone container to separate web and data containers

**URL:** https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413
**Category:** Sysadmins
**Tags:** docker, how-to, advanced-setup, two-container
**Created:** [May 29, 2015, 2:12pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413 "2015-05-29T14:12:22Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![cyberczar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cyberczar/32/188494_2.png) [@cyberczar](https://meta.discourse.org/u/cyberczar)
#### Post date: [July 29, 2020, 8:00pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/90 "2020-07-29T20:00:35Z")

</div>

Excellent. Nope that will be perfect. Thanks again! Very much appreciated.

---

<div class="post-metadata">

### Author: ![geoff777](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoff777/32/202388_2.png) [@geoff777](https://meta.discourse.org/u/geoff777)
#### Post date: [March 10, 2021, 2:22pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/91 "2021-03-10T14:22:01Z")

</div>

The command is now `./discourse-setup --two-container`

worked as expected just now 🥰

---

<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: [March 10, 2021, 3:05pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/92 "2021-03-10T15:05:43Z")

</div>

Good catch! Did it print a message that made it easy to figure that out?

I’ve been meaning to clean up this topic since they change.

---

<div class="post-metadata">

### Author: ![geoff777](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/geoff777/32/202388_2.png) [@geoff777](https://meta.discourse.org/u/geoff777)
#### Post date: [March 10, 2021, 3:10pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/93 "2021-03-10T15:10:02Z")

</div>

Yes, very helpful thanks.

---

<div class="post-metadata">

### Author: ![Marcin\_J](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marcin_j/32/215377_2.png) [@Marcin\_J](https://meta.discourse.org/u/Marcin_J)
#### Post date: [April 28, 2021, 10:56am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/94 "2021-04-28T10:56:50Z")

</div>

Are there any plans to migrate from the old “container links” thing to proper setup with a custom network with two containers being connected to it?  
“Links” are legacy and may be removed in the future according to [Docker docs](https://docs.docker.com/network/links/)

---

<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: [April 28, 2021, 11:03am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/95 "2021-04-28T11:03:07Z")

</div>

That sounds like a good idea.

Unless someone beats me to it, I’ll see about subunits /creating a PR to switch to networks and /or sockets (which some prefer anyway) and creating a howto to convert an existing setup to the new configuration.

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [June 14, 2022, 11:47pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/96 "2022-06-14T23:47:01Z")

</div>

@pfaffman I don’t know whether you got around to it, but if you did, want to link to it here? ☺

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [June 24, 2022, 11:27am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/97 "2022-06-24T11:27:06Z")

</div>

> [@5minpause](#):
>
> ### How to update when using separate web and data containers
> 
> If you do not care about the few minutes of downtime:
> 
> ```plaintext
> ./launcher stop web_only && ./launcher rebuild data && ./launcher rebuild web_only
> 
> ```
> 
> If you care about every minute of downtime:
> 
> ##### for `data`:
> 
> ```plaintext
> ./launcher bootstrap data && ./launcher destroy data && ./launcher start data
> 
> ```
> 
> ##### for `web_only`:
> 
> ```plaintext
> ./launcher bootstrap web_only && ./launcher destroy web_only && ./launcher start web_only
> 
> ```

Should we add a `&& ./launcher cleanup` to the end of these commands?

I’ve found after switching to a two container install that it doesn’t take long to fill up the available storage with old images.

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [September 24, 2022, 10:28pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/98 "2022-09-24T22:28:54Z")

</div>

> [@nathankershaw](#):
>
> Should we add a `&& ./launcher cleanup` to the end of these commands?

I definitely recommend that in my guide… A lot of folks deploy on smallish systems like DO droplets and I know I’ve helped others who didn’t quite realize where their space was going.

> [@MKJ's Opinionated Discourse Deployment Configuration](https://meta.discourse.org/t/mkjs-opinionated-discourse-deployment-configuration/193355):
>
> I have been running a Discourse forum with a substantial amount of content and plenty of images over the past few years. [Maker Forums](https://forum.makerforums.info/) has over 100GB of images and over 400,000 posts, of which a substantial amount was imported, primarily from Google+, and the rest was created on the site. This post describes elements of how I eventually configured Maker Forums and, later, a few other Discourse instances. This is what I wish I knew when I got started, and which I’ve used to help others avoid some …

---

<div class="post-metadata">

### Author: ![BasilBoluk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/basilboluk/32/323650_2.png) [@BasilBoluk](https://meta.discourse.org/u/BasilBoluk)
#### Post date: [August 31, 2023, 1:32pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/99 "2023-08-31T13:32:31Z")

</div>

@pfaffman, Hi,  
A few days ago I installed AWS EC2 with a single container and everything worked fine. But I need exactly the two container configuration, web\_only on EC2 and data on AWS RDS (PostgreSQL 15.3 on port 5432 =\> I can’t choose another version, and the database has no DB\_NAME parameter). As a Redis cluster I tried using AWS ElastiCache, but then left a link in the data.yml to the existing template:

```plaintext
  #- "templates/postgres.template.yml"
  - "templates/redis.template.yml"

```

After successfully bootstrapping data and web\_only I can’t open the webpage. _“This site can’t be reached”_

I haven’t made any changes to DNS records or changed the access settings in AWS security groups (firewall for web and database).

```plaintext
Successfully bootstrapped, to startup use ./launcher start data
root@ip-172-31-3-68:/var/discourse# ./launcher start data
x86_64 arch detected.

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -h ip-172-31-3-68-data -e DOCKER_HOST_IP=172.17.0.1 --name data -t -v /var/discourse/shared/data:/shared -v /var/discourse/shared/data/log/var-log:/var/log --mac-address <...> local_discourse/data /sbin/boot
27b66e577d250e4178f5e145c9962be7b5f2d905cfacd233d3d2278e7b83aa93

```

```plaintext
Successfully bootstrapped, to startup use ./launcher start web_only
root@ip-172-31-3-68:/var/discourse# ./launcher start web_only
x86_64 arch detected.

+ /usr/bin/docker run --shm-size=512m --link data:data -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=2 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET= -e DISCOURSE_DB_HOST=database-discourse.<..>.rds.amazonaws.com -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_FORCE_HTTPS=true -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=talk.furtherium.com -e DISCOURSE_DEVELOPER_EMAILS=hello@furtherium.com -e DISCOURSE_SMTP_ADDRESS=email-smtp.us-east-2.amazonaws.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=A<...>S -e DISCOURSE_SMTP_PASSWORD=B<...>M -e DISCOURSE_NOTIFICATION_EMAIL=noreply@talk.furtherium.com -e LETSENCRYPT_ACCOUNT_EMAIL=me@example.com -e DISCOURSE_DB_NAME= -e DISCOURSE_DB_USERNAME=postgres -e DISCOURSE_DB_PASSWORD=7<...>1 -e DISCOURSE_REDIS_HOST=data -h ip-172-31-3-68-web-only -e DOCKER_HOST_IP=172.17.0.1 --name web_only -t -p 80:80 -p 443:443 -v /var/discourse/shared/web-only:/shared -v /var/discourse/shared/web-only/log/var-log:/var/log --mac-address <...> local_discourse/web_only /sbin/boot
1233f1c660eb7cecc48d2a840aae037b46ecfd7afe029ef89b2e686b136b9886

```

- I checked the connection to the database from SSH using telnet - OK
- I can see the database connections in the AWS RDS dashboard
- I have rebooted instances 3 times
- I have run rebuild 3-4 times without errors
- I checked the list of active containers and images, cleaned up unnecessary ones

```plaintext
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1233f1c660eb local_discourse/web_only "/sbin/boot" 18 minutes ago Up 18 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp web_only
27b66e577d25 local_discourse/data "/sbin/boot" 47 minutes ago Up 47 minutes data

```

What else can I do? Thank you for your efforts and time!

---

<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: [August 31, 2023, 1:38pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/100 "2023-08-31T13:38:23Z")

</div>

> [@BasilBoluk](#):
>
> But I need exactly the two container configuration,

You do not. You only need the web container and to delete the Postgres and Redis templates. Elasticache is, in my opinion, absurdly expensive, so you could run it on your EC2 if you’re using a single host.

Just add the ENV variables to your existing `app.yml` and delete the unnecessary templates. I heard recently that this site is running on PG15, so that should be fine.

---

<div class="post-metadata">

### Author: ![BasilBoluk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/basilboluk/32/323650_2.png) [@BasilBoluk](https://meta.discourse.org/u/BasilBoluk)
#### Post date: [August 31, 2023, 2:02pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/101 "2023-08-31T14:02:54Z")

</div>

> [@pfaffman](#):
>
> You only need the web container and to delete the Postgres and Redis templates.  
> Just add the ENV variables to your existing `app.yml` and delete the unnecessary templates.

Thanks for the reply, Jay (@pfaffman). I just want to clarify:

- should I use the single container app.yml installation and comment in the lines about database and redis? and also in the ENV field of app.yml then add lines for the remote database in AWS (DB\_USER, etc. - from web\_only as now)?
- or do I leave it as is, but stop the data container and leave only web-only?
- If I don’t use ElastiCache, then I need to leave the “templates/redis.template.yml” line?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [February 9, 2025, 9:20pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/102 "2025-02-09T21:20:29Z")

</div>

Changing from standard to two container went almost smoothly. I wasted quit much time because of some missing spaces in yml-file, that tried to convince me I had localization issues (not even close) but that was a user error.

But when I got forum up, I had pure virgin forum. That was quite easy to fix, because I had up-to-date backup in S3, but I’m now wondering why it happened in the first place — any guesses?

I mean taking the route where I would install totally new two container setup and then restoring it from backups could save some time. Or not, because I would still edit yml, at least adding plugins, fixing email settings, maxmind etc.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [February 9, 2025, 11:41pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/103 "2025-02-09T23:41:42Z")

</div>

[Not related to the post above]

I’m wondering, what is the advantage of using a two-container setup? Why not the normal single container?

---

<div class="post-metadata">

### Author: ![David\_Ghost](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@David\_Ghost](https://meta.discourse.org/u/David_Ghost)
#### Post date: [February 9, 2025, 11:48pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/104 "2025-02-09T23:48:04Z")

</div>

I think its for not have your forum offline when you do a rebuild for upgrades/installing a plugin

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [February 10, 2025, 6:40am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/105 "2025-02-10T06:40:50Z")

</div>

For me it is already mentioned short downtime. Plus I upgrade often, at least once a week, so my setup is prone to hit against bugs — not so often, must say, but every now and then still.

Those times when the reason is a plugin — not often, mostly it is some component — I need three to four rounds to solve out problematic one. And when every round takes something like closer to 30 minutes, my forum would be down little bit too long, even it is small and hobbybased.

And the third reason is because I could.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [July 31, 2025, 11:08pm UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/106 "2025-07-31T23:08:41Z")

</div>

> [@NateDhaliwal](#):
>
> I’m wondering, what is the advantage of using a two-container setup? Why not the normal single container?

I find it extremely stressful if a rebuild fails and my site goes down. Basically, it demands my immediate (and sometimes prolonged) attention to sort / find a workaround. Not fun at all!!!

The two-container install converts this to a mere inconvenience, and the underlying issue can usually be dealt at a time that suits me. Also, the issue that caused the problem has often been sorted by that stage.

If using `stable`, I probably wouldn’t bother. But living closer to the edge using `tests-passed`, it is invaluable for the resilience it grants during rebuilds / updates.

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [August 1, 2025, 3:54am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/107 "2025-08-01T03:54:49Z")

</div>

Ah, I see. Thanks for the explanation!  
I completely forgot I even posted that!

---

<div class="post-metadata">

### Author: ![David\_Ghost](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@David\_Ghost](https://meta.discourse.org/u/David_Ghost)
#### Post date: [August 2, 2025, 5:09am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/108 "2025-08-02T05:09:05Z")

</div>

Nice tuto. It takes me only 5 minutes, with a new server, create and restore the backup then `./discourse-setup --two-container`.

Thank you

---

<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: [August 2, 2025, 10:22am UTC](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413/109 "2025-08-02T10:22:05Z")

</div>

> [@5minpause](#):
>
> Backup your discourse instance and download backup. You can follow the [simple guide](https://meta.discourse.org/t/move-your-discourse-instance-to-a-different-server/15721) or [backup and restore later manually](https://meta.discourse.org/t/advanced-manual-method-of-manually-creating-and-restoring-discourse-backups/18273).

Can anyone explain why, if you are converting an existing server with a healthy database, this step is necessary?

I get creating a safe off-site back-up just before migration is good practice, but why the download?

[Previous page](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413.md?page=4)

[Next page](https://meta.discourse.org/t/move-from-standalone-container-to-separate-web-and-data-containers/29413.md?page=6)
