LemmyNet / lemmy-ansible

A docker deploy for ansible
GNU Affero General Public License v3.0
248 stars 94 forks source link

Problem with docker-compose step #239

Closed jlandahl closed 2 months ago

jlandahl commented 2 months ago

I just setup a new Lemmy site the other day following all the instructions in the readme and hit a snag at the docker-compose step. There was an issue with the Ansible community.docker collection relating to a newer version of urllib3 (https://github.com/docker/docker-py/issues/3113) that has since been fixed.

But after quite a lot of digging and trial and error, I discovered that the community.docker.docker_compose action (used here) has been deprecated in favor of community.docker.docker_compose_v2, and it looks like the bug may have only been fixed in the _v2 version. That's my conclusion, at least, since I was able to get the playbook to work by switching to the v2 action.

Here's the diff that got me up and running:

diff --git a/lemmy.yml b/lemmy.yml
index 55b17a2..d497ba2 100644
--- a/lemmy.yml
+++ b/lemmy.yml
@@ -312,10 +312,10 @@
     # - debug: var=shell_output

     - name: Start docker-compose
-      community.docker.docker_compose:
+      community.docker.docker_compose_v2:
         project_src: "{{ lemmy_base_dir }}/{{ domain }}"
         state: present
-        pull: true
+        pull: always
         remove_orphans: true
       tags:
         - docker

The change to the pull setting was required because v2 now takes a string from a list of options rather than a boolean.

I'll be happy to submit a PR for this, but I thought I'd document it here first since I don't know if this has been encountered by anyone else yet.

Updated to add: this was on a brand new VM running Ubuntu 24.04 with Python 3.12, so that could be where the problems cropped up.

dessalines commented 2 months ago

Sure, a PR would be much appreciated, esp since they deprecated that plugin.

Nothing4You commented 2 months ago

@ticoombs has already been working on this in #237, but it might make sense to split the compose v2 change from the other changes, as this seems more urgent?

jlandahl commented 2 months ago

I submitted PR https://github.com/LemmyNet/lemmy-ansible/pull/240. I just looked at https://github.com/LemmyNet/lemmy-ansible/pull/237 and see that it already changed to docker_compose_v2, but it still has the setting pull: true. That won't work anymore since the setting has been changed from a boolean to a string.