# Need a how-to guide for using DigitalOcean Block Storage for image uploads

**URL:** https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535
**Category:** Support
**Created:** [1 Settembre 2016, 7:18am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535 "2016-09-01T07:18:26Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [1 Settembre 2016, 7:18am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/1 "2016-09-01T07:18:26Z")

</div>

Dear community

[Digital Ocean Block Storage](https://www.digitalocean.com/products/storage/) has been available since some time ago.

Because Discourse officially endorses Digital Ocean in their “do it yourself” setup guide, it would be very helpful to have a how-to that explains how to enable Block Storage and use it for image upload.

Anyone keen on writing one?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [1 Settembre 2016, 8:58am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/2 "2016-09-01T08:58:56Z")

</div>

Good idea.

Current block storage is like a remote drive you mount in any Linux / Unix.

Current DO pricing for storage is $1 per month per 10gb. Certainly more cost effective than upsizing the droplet if you don’t need more CPU and RAM.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [1 Settembre 2016, 9:04am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/3 "2016-09-01T09:04:28Z")

</div>

There really isn’t anything Discourse-specific involved in using DO block storage… create storage volume, mount wherever you want to store lots of stuff (I’d say `/var/discourse/shared`, but YMMV) and you’re away.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [1 Settembre 2016, 11:06am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/4 "2016-09-01T11:06:48Z")

</div>

@mpalmer a step-by-step guide similar to DO setup guide would be very appreciated.

Among the commands to run to follow what you said in one paragraph, it should also include some info about how to do it all for an existing Discourse setup with lots of images uploaded.

---

<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: [1 Settembre 2016, 2:51pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/5 "2016-09-01T14:51:33Z")

</div>

Indeed. How to mount the volume and then get stuff moved to it and the mount point moved to the right place is a bit tricky.

I’ve got a couple projects winding down and might be able to do it next week if there is interest.

---

<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: [1 Settembre 2016, 6:49pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/6 "2016-09-01T18:49:27Z")

</div>

Part of me thinks that if you need to attach extra storage then you need to have enough sysadmin skills to mount a volume wherever you want it and deal.

It seems too that droplets created before they started the service don’t support it, so many users would need to create a new droplet to take advantage of the service.

Another solution would be to create a script or modify `discourse-setup` such that if you have a volume mounted it would offer to move `/var/discourse/shared` (or maybe `/var/discourse/standalone`?) to the volume and symlink to it. The user would need to have created a volume and followed DO’s instructions for formatting and mounting it, but the script could handle the rest. This will make writing the instructions considerably easier since it’d be something like

- Create a volume
- copy and paste DO’s recommended commands to format and mount the volume
- `cd /var/discourse; ./discourse-setup`
- Follow the prompts

I’ve been wanting to fix `discourse-setup` so that it’ll read an existing `app.yml` to let people make changes to an already set up instance anyway.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [1 Settembre 2016, 8:33pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/7 "2016-09-01T20:33:26Z")

</div>

> [@pfaffman](#):
>
> Part of me thinks that if you need to attach extra storage then you need to have enough sysadmin skills to mount a volume wherever you want it and deal.

Both basic Discourse DigitalOcean setup and additional configuration all can be done by going through step-by-step guides with no sysadmin skills.

Because the standard recommended setup guide is there, based on that setup it is possible to write another standard step-by-step guide, which I’m asking for 🙂

A guide is at least something for people to try, even if they don’t have enough sysadmin skills. It is better than guide absence.

---

<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: [1 Settembre 2016, 8:42pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/8 "2016-09-01T20:42:18Z")

</div>

> [@meglio](#):
>
> A guide is at least something for people to try, even if they don’t have enough sysadmin skills. It is better than guide absence.

I would agree except that it’s easier to write a script that a computer can follow than one that a person can. 🙂

With a few tweaks to `./discourse-setup` you’ll be able to have that block storage without having to get your hands dirty with `mv` and `ln`.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2 Settembre 2016, 12:02am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/9 "2016-09-02T00:02:36Z")

</div>

We need to determine performance before making recommendations.

EG: if this thing is slow then the recommendation would be to keep PG on local and images (both docker and pictures) on block storage. That would require a bit of fancy.

---

<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: [2 Settembre 2016, 6:29pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/10 "2016-09-02T18:29:31Z")

</div>

> [@sam](#):
>
> We need to determine performance before making recommendations.

The man makes a point. It appears to be less than 1/3 the speed on the simplest of benchmarks. (I checked and both the host and the storage are at SFO2.)

```plaintext
root#:dd if=/dev/zero of=/tmp/output conv=fdatasync bs=384k count=1k
1024+0 records in
1024+0 records out
402653184 bytes (403 MB, 384 MiB) copied, 0.590498 s, 682 MB/s
root#:dd if=/dev/zero of=/mnt/volume-sfo2-01/test conv=fdatasync bs=384k count=1k
1024+0 records in
1024+0 records out
402653184 bytes (403 MB, 384 MiB) copied, 1.99937 s, 201 MB/s

```

> [@sam](#):
>
> the recommendation would be to keep PG on local and images (both docker and pictures) on block storage. That would require a bit of fancy.

It seems to me that moving the images to the other storage is as simple as shutting down Discourse and

```plaintext
cd /var/discourse
./launcher stop app
cd /var/discourse/shared/standalone
mv uploads /mnt/volume-sfo2-01/uploads # script'd need to find this
ln -s /mnt/volume-sfo2-01/uploads .
cd -
./launcher start app

```

(Hey, @meglio, there’s your HOWTO 🙂)

Docker images don’t get that big if you purge them periodically, so don’t I understand why to bother moving them. What am I missing?

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [25 Settembre 2016, 7:53am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/11 "2016-09-25T07:53:02Z")

</div>

> [@sam](#):
>
> We need to determine performance before making recommendations.

Will there be an update any time soon? We’re close to the out of space moment and would like to follow the official recommendations from Discourse team.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [7 Marzo 2017, 12:49am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/12 "2017-03-07T00:49:21Z")

</div>

Bump. Anyone has used DigitalOcean Block Storage for image uploads since then? If so, please share your experience.

I’m still hoping to get an “official way” / recommendation from the team regarding how to use DO Block Storage for uploads. Have been hoping since it was said that it is

> [@codinghorror](#):
>
> Good idea.

😉 if anyone from the team can look into it that would be very appreciated.

---

<div class="post-metadata">

### Author: ![tehn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tehn/32/121106_2.png) [@tehn](https://meta.discourse.org/u/tehn)
#### Post date: [3 Aprile 2017, 6:24pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/13 "2017-04-03T18:24:10Z")

</div>

Hello!

So I’ve tried adding a DO block for our `uploads` folder following your script. All the permissions seem fine.

But there’s clearly something not configured as now all images are 404, even though I can see them as moved. Furthermore uploading new images isn’t working-- just stalls.

Any pointers on the final configuration needed for this to work?

---

<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: [3 Aprile 2017, 6:27pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/14 "2017-04-03T18:27:55Z")

</div>

Sorry, but not offhand.

On the system where I’d done a very quick test, I noticed that there was something strange about how the images were stored. I didn’t take careful notice of just what the deal was, though.

Hey, @sam, do you see any obvious flaws in my code above to move images to a different volume?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [3 Aprile 2017, 7:22pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/15 "2017-04-03T19:22:38Z")

</div>

I would recommend against symlinking, instead, copy images and amend your container config to point `/shared/uploads` at the correct location.

---

<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: [3 Aprile 2017, 7:30pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/16 "2017-04-03T19:30:53Z")

</div>

So, @tehn, you’d add something like this in the `volumes` section of your `app.yml`

```plaintext
   - volume:
       host: /other/volume/uploads
      guest: /shared/uploads

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [3 Aprile 2017, 7:33pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/17 "2017-04-03T19:33:16Z")

</div>

more or less, you want to get indenting right, but that is the gist of how to do it.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [4 Aprile 2017, 4:47am UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/18 "2017-04-04T04:47:19Z")

</div>

@pfaffman, so the idea is to let Discourse think it’s still using the same path for uploads, but move the path to a block storage unit and let the Docker do the mounting?

@tehn did you get it working? If so, how is it going? Any performance issues or any other issues?

---

<div class="post-metadata">

### Author: ![tehn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tehn/32/121106_2.png) [@tehn](https://meta.discourse.org/u/tehn)
#### Post date: [4 Aprile 2017, 12:12pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/19 "2017-04-04T12:12:40Z")

</div>

This worked, thank you all.

I haven’t noticed any performance issues.

---

<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: [4 Aprile 2017, 2:30pm UTC](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535/20 "2017-04-04T14:30:17Z")

</div>

I think it should be fine for images, but not the database.

Thanks for the report!

[Next page](https://meta.discourse.org/t/need-a-how-to-guide-for-using-digitalocean-block-storage-for-image-uploads/49535.md?page=2)
