Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Lokole's Python dependencies #3276

Merged
merged 8 commits into from
Sep 27, 2022
14 changes: 2 additions & 12 deletions roles/lokole/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,14 @@
- wvdial
state: present

- name: "workarounds for older flask version used"
pip:
name: "{{ item.name }}"
version: "{{ item.version }}"
virtualenv: "{{ lokole_venv }}"
virtualenv_command: python3 -m venv "{{ lokole_venv }}"
extra_args: --no-cache-dir # To avoid caching issues e.g. soon after new releases hit https://pypi.org/project/opwen-email-client/
with_items:
- { name: 'itsdangerous', version: '2.0.1' }
- { name: 'Jinja2', version: '3.0.3' }


# For development purposes -- To install Lokole from a given commit, add the
# following line to roles/lokole/defaults/main.yml:
# lokole_commit: <git_commit_id>
# TODO: revert back to main remo after upstream PR is merged
- name: "OPTIONAL: pip install opwen_email_client (Lokole, git commit {{ lokole_commit }}) from GitHub to {{ lokole_venv }}, if lokole_commit is defined"
pip:
name: "git+https://github.com/ascoderu/lokole.git@{{ lokole_commit }}#egg=opwen_email_client"
name: "git+https://github.com/mabuelhagag/lokole.git@{{ lokole_commit }}#egg=opwen_email_client"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary during testing, right?

(Presumably account 'mabuelhagag' will be changed back to 'ascoderu' later?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, until upstream is merged

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might have to drop the 'git+' part and tinker with the rest of the string to get it right, but that is the general idea.

Copy link
Contributor

@jvonau jvonau Jun 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could move the definition from hardcoded to softcoded and use local_vars to override.

pip:
  name: "{{  lokole_repo  }}" 

then define in defaults/main.yml
lokole_repo: git+https://github.com/ascoderu/lokole.git@{{ lokole_commit }}#egg=opwen_email_client
and then use the override in local_vars.yml
lokole_repo: git+https://github.com/mabuelhagag/lokole.git@{{ lokole_commit }}#egg=opwen_email_client

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if 191e757 does it

virtualenv: "{{ lokole_venv }}"
virtualenv_command: python3 -m venv "{{ lokole_venv }}"
extra_args: --no-cache-dir # To avoid caching issues e.g. soon after new releases hit https://pypi.org/project/opwen-email-client/
Expand Down
4 changes: 3 additions & 1 deletion roles/lokole/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
- name: Create Lokole admin user with password, for http://box{{ lokole_url }} # http://box/lokole
shell: |
while read envvar; do export "$envvar"; done < {{ lokole_run_dir }}/settings.env
{{ lokole_venv }}/bin/manage.py createadmin --name='{{ lokole_admin_user }}' --password='{{ lokole_admin_password }}'
cd {{ lokole_venv }}/lib/python${python_version}/site-packages/
export FLASK_APP="opwen_email_client.webapp:app"
{{ lokole_venv }}/bin/flask manage createadmin --name='{{ lokole_admin_user }}' --password='{{ lokole_admin_password }}'

- name: Change owner of dbfiles
file:
Expand Down
4 changes: 2 additions & 2 deletions roles/lokole/templates/lokole_restarter.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[program:lokole_restarter]
command={{ lokole_venv }}/bin/manage.py restarter --directory={{ lokole_run_dir }}/lokole_restarter
command={{ lokole_venv }}/bin/flask manage restarter --directory={{ lokole_run_dir }}/lokole_restarter
autostart=true
autorestart=true
startretries=3
stopasgroup=true
stderr_logfile={{ lokole_log_dir }}/lokole_restarter.stderr.log
stdout_logfile={{ lokole_log_dir }}/lokole_restarter.stdout.log
user=root
environment=OPWEN_SETTINGS={{ lokole_settings }}
environment=FLASK_APP="opwen_email_client.webapp",OPWEN_SETTINGS={{ lokole_settings }}