diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index c47ed8eedef1513879571b00043408ed1d510c23..613d9753c7a7bc264fe49055a2de58d514c0ca95 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -105,3 +105,17 @@ def test_virtualenv(host): intersection = expected_packages & names assert intersection == expected_packages + + +def test_static_files_copied(host): + f = host.file("/srv/funkwhale/data/static/admin/css/base.css") + + assert f.exists is True + + +def test_migrations_applied(host): + cmd = """ + sudo -u postgres psql funkwhale -A -t -c "SELECT 1 from django_migrations where app = 'music' and name = '0039_auto_20190423_0820';" + """ + result = host.run(cmd) + assert result.stdout == "1" diff --git a/tasks/funkwhale.yml b/tasks/funkwhale.yml index 109030604c8a49b5ef986e7a438de941bca09fed..0e0ea955345628f674c0f7a913fe27ea687e052a 100644 --- a/tasks/funkwhale.yml +++ b/tasks/funkwhale.yml @@ -74,6 +74,8 @@ remote_src: true - name: "Setup virtualenv" + become: true + become_user: "{{ funkwhale_username }}" pip: name: wheel virtualenv: "{{ funkwhale_install_path }}/virtualenv" @@ -81,7 +83,25 @@ - name: "Install python dependencies" + become: true + become_user: "{{ funkwhale_username }}" pip: requirements: "{{ funkwhale_install_path }}/api/requirements.txt" virtualenv: "{{ funkwhale_install_path }}/virtualenv" virtualenv_python: python3 + + +- name: "Collect static files" + command: "{{ funkwhale_install_path }}/virtualenv/bin/python api/manage.py collectstatic --no-input" + become: true + become_user: "{{ funkwhale_username }}" + args: + chdir: "{{ funkwhale_install_path }}" + + +- name: "Apply database migrations" + become: true + become_user: "{{ funkwhale_username }}" + command: "{{ funkwhale_install_path }}/virtualenv/bin/python api/manage.py migrate --no-input" + args: + chdir: "{{ funkwhale_install_path }}" diff --git a/tasks/main.yml b/tasks/main.yml index 1f5d6358f237641cb8892799ca22421da0a8d195..f22e3acfdf026f4975466fc166ba2dc50df76ad4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,6 @@ --- -- include: packages.yml -- include: db.yml -- include: redis.yml +# - include: packages.yml +# - include: db.yml +# - include: redis.yml - include: funkwhale.yml - include: nginx.yml