saltyorg / Sandbox

Saltbox Sandbox
GNU General Public License v3.0
64 stars 91 forks source link

App Request: Unifi Network Application #305

Closed FuRy2K closed 7 months ago

FuRy2K commented 8 months ago

As per https://info.linuxserver.io/issues/2023-09-06-unifi-controller/ the LSIO Unifi controller will be deprecated on 2024-01-01

The replacement container isn't a drop-in replacement and requires an external mongodb instance. More info here: https://github.com/linuxserver/docker-unifi-network-application#application-setup

owine commented 8 months ago

I've made the changes on the unifi-refactor branch https://github.com/saltyorg/Sandbox/tree/unifi-refactor

Can you test?

FuRy2K commented 8 months ago

Got the following error. If you need further debug logs let me know.

TASK [unifi : Unifi | Import init-mongo.js] ******************************************************************************************************************************************************************** Tuesday 07 November 2023 10:30:27 -0500 (0:00:00.158) 0:00:34.661 ****** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleError: template error while templating string: expected token 'end of print statement', got 'dbname'. String: db.getSiblingDB("{{ unifi_mongo_ dbname }}").createUser({user: "{{ unifi_mongo_user }}", pwd: "{{ unifi_mongo_pass }}", roles: [{role: "dbOwner", db: "{{ unifi_mongo_dbname }}"}, {role: "dbOwner", db: "{{ unifi_mongo_dbname }}_stat"}]});. expected token 'end of print statement', got 'dbname' fatal: [localhost]: FAILED! => {"changed": false, "msg": "AnsibleError: template error while templating string: expected token 'end of print statement', got 'dbname'. String: db.getSiblingDB(\"{{ unifi_mongo_ dbname }}\").createUser({user: \"{{ unifi_mongo_user }}\", pwd: \"{{ unifi_mongo_pass }}\", roles: [{role: \"dbOwner\", db: \"{{ unifi_mongo_dbname }}\"}, {role: \"dbOwner\", db: \"{{ unifi_mongo_dbname }}_stat\"}]});. expected token 'end of print statement', got 'dbname'"}

owine commented 8 months ago

Had a space that should not have been - Fix committed

saltydk commented 8 months ago

Is the colon in the dbname needed?

FuRy2K commented 8 months ago

Got past the init-mongo.js error.

Now getting the following

TASK [unifi : Resources | Tasks | Docker | Create Docker Container | Create Docker Container] ****************************************************************************************************************** Tuesday 07 November 2023 10:46:46 -0500 (0:00:00.123) 0:01:33.253 ****** fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'unifi_docker_image_repo' is undefined. 'unifi_docker_image_repo' is undefined. 'unifi_docker_image_repo' is undefined. 'unifi_docker_image_repo' is undefined\n\nThe error appears to be in '/srv/git/saltbox/resources/tasks/docker/create_docker_container.yml': line 20, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Resources | Tasks | Docker | Create Docker Container | Create Docker Container # noqa args[module]\n ^ here\n"}

saltydk commented 8 months ago

@owine you called the var unufi_docker_image_repo

owine commented 8 months ago

@owine you called the var unufi_docker_image_repo

Make more coffee please

FuRy2K commented 8 months ago

More coffee coming.

TASK [unifi : Resources | Tasks | Docker | Create Docker Container | Create Docker Container] ****************************************************************************************************************** Tuesday 07 November 2023 11:06:29 -0500 (0:00:00.129) 0:01:19.575 ****** fatal: [localhost]: FAILED! => {"attempts": 1, "changed": false, "msg": "Non-string value found for env option. Ambiguous env options must be wrapped in quotes to avoid them being interpreted. Key: MONGO_PORT"}

FuRy2K commented 8 months ago

I was getting a 404 error from the Unifi container on first boot. But I renamed /opt/unifi to /opt/unifi.bak and re-ran the tag and it came up fine as a fresh install.

I then had to restore my config from backup located at /opt/unifi.bak/data/backup using Unfi's setup wizard.

I'm up and running, but it's not a simple drop in replacement.

owine commented 8 months ago

Which begs the question of whether we do this as a unifi tag deprecation and a new unifi-network-application tag.

Barrow1990 commented 7 months ago

Which begs the question of whether we do this as a unifi tag deprecation and a new unifi-network-application tag.

Thank you owine for your time and effort to get this app updated / upgraded. Unless you can script to move the data across youve a few options:

  1. add a different sandbox tag a. easier to implement b. risk of anyone on the unifi tag to be outdated / unsupported c. require user to backup original and then restore to this
  2. understand the differences and migrate the data (I get the impression this will be intensive or impossible)
  3. over-ride unifi tag a. more issues coming from it due to incompatibility a. could add a check in to see if its the old 1 or not b. data could be loss with over-writing the data

How do i go about testing this?

Also just looking at the role and its hard-coded the password for mongo db. Feel like this needs to be either pulled from config and/or random generated and pushed to config