Move volumes into subfolder (ref #474) #23

Merged
dessalines merged 4 commits from nutomic/lemmy:docker-volumes-in-subfolder into master 2020-03-09 16:50:29 +00:00
Owner

Realized that this one is actually pretty easy. Instructions (already verified on test.lemmy.ml, should go in the changelog)

# on lemmy server:
cd /lemmy/
docker-compose down
rsync -a /var/lib/docker/volumes/lemmy_lemmy_db/_data/ volumes/postgres/
rsync -a /var/lib/docker/volumes/lemmy_lemmy_pictshare/_data/ volumes/pictshare/

# locally, in lemmy git repo
git pull
cd ansible
ansible-playbook lemmy.yml
# note: for deployment without ansible, update docker-compose.yml manually and run docker-compose up -d

# if everything went well, you can remove the docker volumes on the server with:
docker volume rm lemmy_lemmy_iframely lemmy_lemmy_db  lemmy_lemmy_pictshare

@dessalines Btw the volume lemmy_iframely was unused, not sure if that is actually needed.

Realized that this one is actually pretty easy. Instructions (already verified on test.lemmy.ml, should go in the changelog) ``` # on lemmy server: cd /lemmy/ docker-compose down rsync -a /var/lib/docker/volumes/lemmy_lemmy_db/_data/ volumes/postgres/ rsync -a /var/lib/docker/volumes/lemmy_lemmy_pictshare/_data/ volumes/pictshare/ # locally, in lemmy git repo git pull cd ansible ansible-playbook lemmy.yml # note: for deployment without ansible, update docker-compose.yml manually and run docker-compose up -d # if everything went well, you can remove the docker volumes on the server with: docker volume rm lemmy_lemmy_iframely lemmy_lemmy_db lemmy_lemmy_pictshare ``` @dessalines Btw the volume `lemmy_iframely` was unused, not sure if that is actually needed.
Author
Owner

Also, is there a particular reason that you put a lemmy_ prefix for the container names? It seems like docker-compose automatically puts the folder name as prefix, so if you run docker container ls (and in other places), you see names like lemmy_lemmy_db_1 which is redundant.

Also, is there a particular reason that you put a `lemmy_` prefix for the container names? It seems like docker-compose automatically puts the folder name as prefix, so if you run `docker container ls` (and in other places), you see names like `lemmy_lemmy_db_1` which is redundant.
Owner

Scares me a little bit bc I know docker-compose down removes nearly everything, but it looks like it leaves the volumes in place. I'll test locally too.

Also, is there a particular reason that you put a lemmy_ prefix for the container names?

Good call, you could remove those too.

One other suggestion: could you change the iframely port? I have these two in lib.rs:

  iframely: 
  let fetch_url = format!("http://lemmy_iframely:8061/oembed?url={}", url);
...
  pictshare: 
  let fetch_url = format!(
    "http://lemmy_pictshare/api/geturl.php?url={}",

It makes sense for both their internal ports to be 80 to make those fetches clean. Also obvi those fetch_urls will need to change to http://iframely/oembed... and http://pictshare/api...

Scares me a little bit bc I know `docker-compose down` removes nearly everything, but it looks like it leaves the volumes in place. I'll test locally too. > Also, is there a particular reason that you put a lemmy_ prefix for the container names? Good call, you could remove those too. One other suggestion: could you change the iframely port? I have these two in `lib.rs`: ``` iframely: let fetch_url = format!("http://lemmy_iframely:8061/oembed?url={}", url); ... pictshare: let fetch_url = format!( "http://lemmy_pictshare/api/geturl.php?url={}", ``` It makes sense for both their internal ports to be `80` to make those fetches clean. Also obvi those fetch_urls will need to change to `http://iframely/oembed...` and `http://pictshare/api...`
Owner

Oh and those volumes folders will need to be added to the .gitignore for the dev folder.

Oh and those volumes folders will need to be added to the `.gitignore` for the dev folder.
Owner

It worked btw, nice!

It worked btw, nice!
Author
Owner

docker-compose down just stops the running containers, the only thing it removes is the network afaik. I never had any problems with running it.

Did the changes you mentioned, already tested it locally and on test.lemmy.ml. If you update an instance where you already added the previous commit, you have to run docker-compose down before the upgrade (otherwise just do both at once).

Also please squash the commits before merging, Gitea has a button for that.

`docker-compose down` just stops the running containers, the only thing it removes is the network afaik. I never had any problems with running it. Did the changes you mentioned, already tested it locally and on test.lemmy.ml. If you update an instance where you already added the previous commit, you have to run `docker-compose down` before the upgrade (otherwise just do both at once). Also please squash the commits before merging, Gitea has a button for that.
Owner

This broke Iframely on the back end for some reason.

logs: iframely err: CouldntResolveHost: couldn't resolve host name

edit: actually wait, it might be because I didn't rebuild with docker-compose up -d --no-deps --build

Yup that was it, my bad.

This broke Iframely on the back end for some reason. logs: `iframely err: CouldntResolveHost: couldn't resolve host name` edit: actually wait, it might be because I didn't rebuild with `docker-compose up -d --no-deps --build` Yup that was it, my bad.
dessalines closed this pull request 2020-03-09 16:50:29 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: LemmyNet/lemmy#23
No description provided.