How to move my Discourse instance LOCALLY? Or at least the big files?


(Dylan Hunt) #1

I started running low on space on digitalocean. Well, I want to add a Volume to mount.

I read a guide on how to change servers, but is there an easier way to simply move the files LOCALLY? As in, just a different hard drive on the same server? Or even just the bigger, bloatier storage (like storing images and backups, etc)?


(Jay Pfaffman) #2

You can add a volume and then move or rsync the files to the new volume.

If you’re not familiar with the unix commands to do that, then just do a backup, change the config, and do a restore.

Then you can rm -r the old copy.


(Dylan Hunt) #3

Hmm, I tried to install a fresh Discourse copy from another directory, but it yells at me that my other discourse app is running on port 80 (was trying to take it down at the very last second). I also remembered I have a weird nginx reverse proxy thing going on, following the guide like a year ago for this:

I wonder if rsync would be king for this instead of a fresh copy + backup + restore? I just need to rsync /var/discourse to my new drive?

I also noticed this in my original app.yml:

image

Can I do anything with this? I don’t necessarily need to move EVERYTHING. I just need to move future stuff so I don’t run out of space.


(Dylan Hunt) #4

Oh, wow. I just followed the rsync instructions from the snippet found here from /var/discourse to /mnt/blah/var (not /discourse or trailing slash or itll make /var/discourse/discourse)

it was pretty straightforward. Still making sure nothings broken, but good so far.

however, I’m suspicious if it’s launching the old directory or not. If I ran from new dir, would it still go to new one? I’m afraid to delete my old one to see lol.

EDIT: I went to the original default install spot and “./launcher stop app” would stop the app. It seems that it doesn’t matter which folder is run, both dirs will stop the app. This means that maybe it’s still running from the original dir? or a 3rd party dir i don’t know about? Not really sure.

EDIT 2: OH! My app.yaml volumes! I need to change that path

volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

>>

volumes:
  - volume:
      host: /mnt/sf02-storage/var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /mnt/sf02-storage/var/discourse/shared/standalone/log/var-log
      guest: /var/log

Can I do this? DONT change the guest section right? hmm, maybe this part I should ask in a sep topic.


(Stephen) #5

As it’s on DO can’t you just image the VM, create a new VM with a larger disk, then restore and resize the partition?


(Dylan Hunt) #6

You can’t resize the main disk, only add volumes. Or perhaps you can, but an insignificant amount at a time (you mostly upgrade for the CPU/RAM, not for the primary SSD storage).

…right? gotta look into this

EDIT: Yep, can’t do that. For like +$25 more per month, you get about +10gb storage. OR you can get 100gb volume for +$10/mo. I would love to ONLY expand my primary drive, but for whatever reason, they don’t do this.

Volumes are annoying D: wish I had this a long time ago before I started getting a complicated setup.

With the new “Volumes” addon to DO, I’m surprised there hasn’t been an official guide, yet. I’ll update if this works.


(Dylan Hunt) #7

When I try ./launcher rebuild app it says Im on an old version of docker, but I have the latest one before I rsync for /var/discourse. Where is it checking for docker? For some reason, it’s detecting an ancient version. I must’ve missed something?


(Jay Pfaffman) #8

If you installed Docker according to directions here, you can upgrade it like this:

   wget -qO- https://get.docker.com/ | sh

(Dylan Hunt) #9

I used the out-of-box digitalocean package + official tutorial a while back, so I probably did this. I can proceed?

Noticing some errors about invalid keys. Is this an old script?

Seems like it detected the upgrade successfully, though. I’m able to move on. However, now I get this (non-critical, it’s still rebuilding, but looks pretty darn critical to me?):

image

EDIT: Wow, docker needs a lot of space. My main point is trying to move big stuff to the new volume. How can I use this script to install Docker in a non-default location on my volume?


(Dylan Hunt) #10

Ok. It seems that I updated docker, rsync’d to /mnt/blah/var/discourse, changed the app.yaml to reflect the moved files…

If I ./launcher stop app in my /mnt/sf02-storage/var/discourse, it seems that it works. However, it’s simply launching my ORIGINAL install @ default /var/discourse. I can tell because if I rename /var/discourse to /var/discourse2, the site goes offline.


(Dylan Hunt) #11

Hmm, any word? Moving to a new DO volume (since the main guide is for DO) seems like it would be a common occurrence, although volumes are still new-ish (but they WILL be a common occurrence soon and this question WILL be asked again and again, in the coming months+). Run out of space, add a volume, move it over~ but I can’t find any tips anywhere on this forum regarding this.

Simply vague answers or keywords like “rsync”. It seems that you can’t just rsync and edit the settings file: Something is missing.

From an above link, here was the rsync example use:

rsync -avzh /var/discourse/shared/standalone/ /var/discourse/shared/standalone.backup

How can I do this right? What am I missing? I feel so close. But if moving /var/discourse and editing app.yaml isn’t enough, what’s left out?


(Jay Pfaffman) #12

You can check this thread: Need a how-to guide for using DigialOcean Block Storage for image uploads.

That’s in the thread above, though not quite as cleanly or clearly as you might like.

You need to edit app.yml to use the new block storage rather than find it in the standard location & then move (or rsync) the stuff to the new block storage location.

Block storage is much slower. It’s fine for backups and images but not recommended for the database.