mirror of
https://github.com/YunoHost-Apps/django_example_ynh.git
synced 2024-09-03 18:26:21 +02:00
commit
9df6139012
28 changed files with 1077 additions and 1362 deletions
96
README.md
96
README.md
|
@ -33,7 +33,7 @@ To demonstrate the functionality the small [django-example](https://github.com/j
|
||||||
Pull requests welcome ;)
|
Pull requests welcome ;)
|
||||||
|
|
||||||
|
|
||||||
**Shipped version:** 0.2.0~ynh1
|
**Shipped version:** 0.2.0~ynh2
|
||||||
## Disclaimers / important information
|
## Disclaimers / important information
|
||||||
|
|
||||||
## local test
|
## local test
|
||||||
|
@ -44,9 +44,9 @@ and urls made for YunoHost installation.
|
||||||
|
|
||||||
e.g.:
|
e.g.:
|
||||||
```bash
|
```bash
|
||||||
~$ git clone https://github.com/YunoHost-Apps/django_example_ynh.git
|
~$ git clone https://github.com/YunoHost-Apps/django_example.git
|
||||||
~$ cd django_example_ynh/
|
~$ cd django_example_ynh/
|
||||||
~/django_example_ynh$ make
|
~/django_example$ make
|
||||||
install-poetry install or update poetry
|
install-poetry install or update poetry
|
||||||
install install project via poetry
|
install install project via poetry
|
||||||
update update the sources and installation and generate "conf/requirements.txt"
|
update update the sources and installation and generate "conf/requirements.txt"
|
||||||
|
@ -59,9 +59,9 @@ publish Release new version to PyPi
|
||||||
local-test Run local_test.py to run the project locally
|
local-test Run local_test.py to run the project locally
|
||||||
local-diff-settings Run "manage.py diffsettings" with local test
|
local-diff-settings Run "manage.py diffsettings" with local test
|
||||||
|
|
||||||
~/django_example_ynh$ make install-poetry
|
~/django_example$ make install-poetry
|
||||||
~/django_example_ynh$ make install
|
~/django_example$ make install
|
||||||
~/django_example_ynh$ make local-test
|
~/django_example$ make local-test
|
||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
@ -73,48 +73,48 @@ Notes:
|
||||||
|
|
||||||
## history
|
## history
|
||||||
|
|
||||||
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.2.0...master) **dev**
|
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example/compare/v0.2.0...master) **dev**
|
||||||
* tbc
|
* tbc
|
||||||
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.5...v0.2.0)
|
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.5...v0.2.0)
|
||||||
* rename/split `django_example_ynh` into:
|
* rename/split `django_example_ynh` into:
|
||||||
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
|
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
|
||||||
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example_ynh) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
|
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
|
||||||
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.4...v0.1.5)
|
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.4...v0.1.5)
|
||||||
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
|
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
|
||||||
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.3...v0.1.4)
|
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.3...v0.1.4)
|
||||||
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example_ynh/issues/7)
|
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example/issues/7)
|
||||||
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.2...v0.1.3)
|
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.2...v0.1.3)
|
||||||
* set "DEBUG = True" in local_test (so static files are served and auth works)
|
* set "DEBUG = True" in local_test (so static files are served and auth works)
|
||||||
* Bugfixes and cleanups
|
* Bugfixes and cleanups
|
||||||
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.1...v0.1.2)
|
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.1...v0.1.2)
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.0...v0.1.1)
|
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.0...v0.1.1)
|
||||||
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
|
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
|
||||||
* Generate "conf/requirements.txt" and use this file for install
|
* Generate "conf/requirements.txt" and use this file for install
|
||||||
* rename own settings and urls (in `/conf/`)
|
* rename own settings and urls (in `/conf/`)
|
||||||
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/f578f14...v0.1.0)
|
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example/compare/f578f14...v0.1.0)
|
||||||
* first working state
|
* first working state
|
||||||
* [23.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/commit/f578f144a3a6d11d7044597c37d550d29c247773)
|
* [23.12.2020](https://github.com/YunoHost-Apps/django_example/commit/f578f144a3a6d11d7044597c37d550d29c247773)
|
||||||
* init the project
|
* init the project
|
||||||
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example_ynh
|
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
* PyPi package: https://pypi.org/project/django-ynh/
|
* PyPi package: https://pypi.org/project/django-ynh/
|
||||||
|
|
||||||
These projects used `django_example_ynh`:
|
These projects used `django_example_ynh`:
|
||||||
|
|
||||||
* https://github.com/YunoHost-Apps/django_example_ynh
|
* https://github.com/YunoHost-Apps/django_example
|
||||||
* https://github.com/YunoHost-Apps/django-for-runners_ynh
|
* https://github.com/YunoHost-Apps/django-for-runners_ynh
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Developer info
|
# Developer info
|
||||||
|
|
||||||
The App project will be stored under `__FINALPATH__` (e.g.: `/opt/yunohost/$app`) that's Django's `settings.FINALPATH`
|
The App project will be stored under `__DATA_DIR__` (e.g.: `/home/yunohost.app/$app/`) that's Django's `settings.DATA_DIR_PATH`
|
||||||
"static" / "media" files to serve via nginx are under `__PUBLIC_PATH__` (e.g.: `/var/www/$app`) that's `settings.PUBLIC_PATH`
|
"static" / "media" files to serve via nginx are under `__INSTALL_DIR__` (e.g.: `/var/www/$app/`) that's `settings.INSTALL_DIR_PATH`
|
||||||
|
|
||||||
## package installation / debugging
|
## package installation / debugging
|
||||||
|
|
||||||
|
@ -127,38 +127,46 @@ To update:
|
||||||
```bash
|
```bash
|
||||||
~# cd django_example_ynh
|
~# cd django_example_ynh
|
||||||
~/django_example_ynh# git fetch && git reset --hard origin/testing
|
~/django_example_ynh# git fetch && git reset --hard origin/testing
|
||||||
~/django_example_ynh# yunohost app upgrade django_example_ynh -u . -F
|
~/django_example_ynh# yunohost app upgrade django_example -u . -F
|
||||||
```
|
```
|
||||||
|
|
||||||
To remove call e.g.:
|
To remove call e.g.:
|
||||||
```bash
|
```bash
|
||||||
sudo yunohost app remove django_example_ynh
|
sudo yunohost app remove django_example
|
||||||
```
|
```
|
||||||
|
|
||||||
Backup / remove / restore cycle, e.g.:
|
Backup / remove / restore cycle, e.g.:
|
||||||
```bash
|
```bash
|
||||||
yunohost backup create --apps django_example_ynh
|
yunohost backup create --apps django_example
|
||||||
yunohost backup list
|
yunohost backup list
|
||||||
archives:
|
archives:
|
||||||
- django_example_ynh-pre-upgrade1
|
- django_example_ynh-pre-upgrade1
|
||||||
- 20201223-163434
|
- 20230822-062848
|
||||||
yunohost app remove django_example_ynh
|
yunohost app remove django_example
|
||||||
yunohost backup restore 20201223-163434 --apps django_example_ynh
|
yunohost backup restore 20230822-062848 --apps django_example
|
||||||
```
|
```
|
||||||
|
|
||||||
Debug the installation, e.g.:
|
Debug the installation, e.g.:
|
||||||
```bash
|
```bash
|
||||||
root@yunohost:~# cat /etc/yunohost/apps/django_example_ynh/settings.yml
|
root@yunohost:~# cat /etc/yunohost/apps/django_example/settings.yml
|
||||||
|
...
|
||||||
|
app: django_example
|
||||||
|
...
|
||||||
|
data_dir: /home/yunohost.app/django_example
|
||||||
|
...
|
||||||
|
install_dir: /var/www/django_example
|
||||||
|
...
|
||||||
|
log_file: /var/log/django_example/django_example.log
|
||||||
...
|
...
|
||||||
|
|
||||||
root@yunohost:~# ls -la /var/www/django_example_ynh/
|
root@yunohost:~# ls -la /var/www/django_example/
|
||||||
total 18
|
total 18
|
||||||
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
||||||
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
||||||
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
||||||
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
||||||
|
|
||||||
root@yunohost:~# ls -la /opt/yunohost/django_example_ynh/
|
root@yunohost:~# ls -la /home/yunohost.app/django_example/
|
||||||
total 58
|
total 58
|
||||||
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
|
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
|
||||||
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
||||||
|
@ -170,21 +178,27 @@ drwxr-xr-x 6 django_example_ynh django_example_ynh 6 Dec 8 08:37 venv
|
||||||
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
|
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
|
||||||
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
|
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
|
||||||
|
|
||||||
root@yunohost:~# cd /opt/yunohost/django_example_ynh/
|
root@yunohost:~# /home/yunohost.app/django_example/manage.py diffsettings
|
||||||
root@yunohost:/opt/yunohost/django_example_ynh# source venv/bin/activate
|
...
|
||||||
(venv) root@yunohost:/opt/yunohost/django_example_ynh# ./manage.py check
|
root@yunohost:~# /home/yunohost.app/django_example/manage.py check
|
||||||
django_example_ynh v0.8.2 (Django v2.2.17)
|
ENV_TYPE:None
|
||||||
DJANGO_SETTINGS_MODULE='django_example_ynh_demo_settings'
|
PROJECT_PATH:/home/yunohost.app/django_example/venv/lib/python3.9/site-packages
|
||||||
PROJECT_PATH:/opt/yunohost/django_example_ynh/venv/lib/python3.7/site-packages
|
BASE_PATH:/root/django_example
|
||||||
BASE_PATH:/opt/yunohost/django_example_ynh
|
|
||||||
System check identified no issues (0 silenced).
|
System check identified no issues (0 silenced).
|
||||||
|
|
||||||
root@yunohost:~# tail -f /var/log/django_example_ynh/django_example_ynh.log
|
root@yunohost:~# cat /etc/systemd/system/django_example.service
|
||||||
root@yunohost:~# cat /etc/systemd/system/systemd.service
|
|
||||||
...
|
...
|
||||||
|
|
||||||
root@yunohost:~# systemctl reload-or-restart django_example_ynh
|
root@yunohost:~# systemctl reload-or-restart django_example
|
||||||
root@yunohost:~# journalctl --unit=django_example_ynh --follow
|
root@yunohost:~# journalctl --unit=django_example --follow
|
||||||
|
...
|
||||||
|
root@yunohost:~# tail -f /var/log/django_example/django_example.log
|
||||||
|
...
|
||||||
|
root@yunohost:~# tail -f /var/log/nginx/*.log
|
||||||
|
...
|
||||||
|
|
||||||
|
root@yunohost:~# ls -la /etc/nginx/conf.d/
|
||||||
|
root@yunohost:~# cat /etc/nginx/conf.d/$domain.d/django_example.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
96
README_fr.md
96
README_fr.md
|
@ -33,7 +33,7 @@ To demonstrate the functionality the small [django-example](https://github.com/j
|
||||||
Pull requests welcome ;)
|
Pull requests welcome ;)
|
||||||
|
|
||||||
|
|
||||||
**Version incluse :** 0.2.0~ynh1
|
**Version incluse :** 0.2.0~ynh2
|
||||||
## Avertissements / informations importantes
|
## Avertissements / informations importantes
|
||||||
|
|
||||||
## local test
|
## local test
|
||||||
|
@ -44,9 +44,9 @@ and urls made for YunoHost installation.
|
||||||
|
|
||||||
e.g.:
|
e.g.:
|
||||||
```bash
|
```bash
|
||||||
~$ git clone https://github.com/YunoHost-Apps/django_example_ynh.git
|
~$ git clone https://github.com/YunoHost-Apps/django_example.git
|
||||||
~$ cd django_example_ynh/
|
~$ cd django_example_ynh/
|
||||||
~/django_example_ynh$ make
|
~/django_example$ make
|
||||||
install-poetry install or update poetry
|
install-poetry install or update poetry
|
||||||
install install project via poetry
|
install install project via poetry
|
||||||
update update the sources and installation and generate "conf/requirements.txt"
|
update update the sources and installation and generate "conf/requirements.txt"
|
||||||
|
@ -59,9 +59,9 @@ publish Release new version to PyPi
|
||||||
local-test Run local_test.py to run the project locally
|
local-test Run local_test.py to run the project locally
|
||||||
local-diff-settings Run "manage.py diffsettings" with local test
|
local-diff-settings Run "manage.py diffsettings" with local test
|
||||||
|
|
||||||
~/django_example_ynh$ make install-poetry
|
~/django_example$ make install-poetry
|
||||||
~/django_example_ynh$ make install
|
~/django_example$ make install
|
||||||
~/django_example_ynh$ make local-test
|
~/django_example$ make local-test
|
||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
@ -73,48 +73,48 @@ Notes:
|
||||||
|
|
||||||
## history
|
## history
|
||||||
|
|
||||||
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.2.0...master) **dev**
|
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example/compare/v0.2.0...master) **dev**
|
||||||
* tbc
|
* tbc
|
||||||
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.5...v0.2.0)
|
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.5...v0.2.0)
|
||||||
* rename/split `django_example_ynh` into:
|
* rename/split `django_example_ynh` into:
|
||||||
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
|
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
|
||||||
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example_ynh) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
|
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
|
||||||
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.4...v0.1.5)
|
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.4...v0.1.5)
|
||||||
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
|
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
|
||||||
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.3...v0.1.4)
|
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.3...v0.1.4)
|
||||||
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example_ynh/issues/7)
|
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example/issues/7)
|
||||||
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.2...v0.1.3)
|
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.2...v0.1.3)
|
||||||
* set "DEBUG = True" in local_test (so static files are served and auth works)
|
* set "DEBUG = True" in local_test (so static files are served and auth works)
|
||||||
* Bugfixes and cleanups
|
* Bugfixes and cleanups
|
||||||
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.1...v0.1.2)
|
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.1...v0.1.2)
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.0...v0.1.1)
|
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.0...v0.1.1)
|
||||||
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
|
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
|
||||||
* Generate "conf/requirements.txt" and use this file for install
|
* Generate "conf/requirements.txt" and use this file for install
|
||||||
* rename own settings and urls (in `/conf/`)
|
* rename own settings and urls (in `/conf/`)
|
||||||
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/f578f14...v0.1.0)
|
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example/compare/f578f14...v0.1.0)
|
||||||
* first working state
|
* first working state
|
||||||
* [23.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/commit/f578f144a3a6d11d7044597c37d550d29c247773)
|
* [23.12.2020](https://github.com/YunoHost-Apps/django_example/commit/f578f144a3a6d11d7044597c37d550d29c247773)
|
||||||
* init the project
|
* init the project
|
||||||
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example_ynh
|
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
* PyPi package: https://pypi.org/project/django-ynh/
|
* PyPi package: https://pypi.org/project/django-ynh/
|
||||||
|
|
||||||
These projects used `django_example_ynh`:
|
These projects used `django_example_ynh`:
|
||||||
|
|
||||||
* https://github.com/YunoHost-Apps/django_example_ynh
|
* https://github.com/YunoHost-Apps/django_example
|
||||||
* https://github.com/YunoHost-Apps/django-for-runners_ynh
|
* https://github.com/YunoHost-Apps/django-for-runners_ynh
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Developer info
|
# Developer info
|
||||||
|
|
||||||
The App project will be stored under `__FINALPATH__` (e.g.: `/opt/yunohost/$app`) that's Django's `settings.FINALPATH`
|
The App project will be stored under `__DATA_DIR__` (e.g.: `/home/yunohost.app/$app/`) that's Django's `settings.DATA_DIR_PATH`
|
||||||
"static" / "media" files to serve via nginx are under `__PUBLIC_PATH__` (e.g.: `/var/www/$app`) that's `settings.PUBLIC_PATH`
|
"static" / "media" files to serve via nginx are under `__INSTALL_DIR__` (e.g.: `/var/www/$app/`) that's `settings.INSTALL_DIR_PATH`
|
||||||
|
|
||||||
## package installation / debugging
|
## package installation / debugging
|
||||||
|
|
||||||
|
@ -127,38 +127,46 @@ To update:
|
||||||
```bash
|
```bash
|
||||||
~# cd django_example_ynh
|
~# cd django_example_ynh
|
||||||
~/django_example_ynh# git fetch && git reset --hard origin/testing
|
~/django_example_ynh# git fetch && git reset --hard origin/testing
|
||||||
~/django_example_ynh# yunohost app upgrade django_example_ynh -u . -F
|
~/django_example_ynh# yunohost app upgrade django_example -u . -F
|
||||||
```
|
```
|
||||||
|
|
||||||
To remove call e.g.:
|
To remove call e.g.:
|
||||||
```bash
|
```bash
|
||||||
sudo yunohost app remove django_example_ynh
|
sudo yunohost app remove django_example
|
||||||
```
|
```
|
||||||
|
|
||||||
Backup / remove / restore cycle, e.g.:
|
Backup / remove / restore cycle, e.g.:
|
||||||
```bash
|
```bash
|
||||||
yunohost backup create --apps django_example_ynh
|
yunohost backup create --apps django_example
|
||||||
yunohost backup list
|
yunohost backup list
|
||||||
archives:
|
archives:
|
||||||
- django_example_ynh-pre-upgrade1
|
- django_example_ynh-pre-upgrade1
|
||||||
- 20201223-163434
|
- 20230822-062848
|
||||||
yunohost app remove django_example_ynh
|
yunohost app remove django_example
|
||||||
yunohost backup restore 20201223-163434 --apps django_example_ynh
|
yunohost backup restore 20230822-062848 --apps django_example
|
||||||
```
|
```
|
||||||
|
|
||||||
Debug the installation, e.g.:
|
Debug the installation, e.g.:
|
||||||
```bash
|
```bash
|
||||||
root@yunohost:~# cat /etc/yunohost/apps/django_example_ynh/settings.yml
|
root@yunohost:~# cat /etc/yunohost/apps/django_example/settings.yml
|
||||||
|
...
|
||||||
|
app: django_example
|
||||||
|
...
|
||||||
|
data_dir: /home/yunohost.app/django_example
|
||||||
|
...
|
||||||
|
install_dir: /var/www/django_example
|
||||||
|
...
|
||||||
|
log_file: /var/log/django_example/django_example.log
|
||||||
...
|
...
|
||||||
|
|
||||||
root@yunohost:~# ls -la /var/www/django_example_ynh/
|
root@yunohost:~# ls -la /var/www/django_example/
|
||||||
total 18
|
total 18
|
||||||
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
||||||
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
||||||
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
||||||
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
||||||
|
|
||||||
root@yunohost:~# ls -la /opt/yunohost/django_example_ynh/
|
root@yunohost:~# ls -la /home/yunohost.app/django_example/
|
||||||
total 58
|
total 58
|
||||||
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
|
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
|
||||||
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
||||||
|
@ -170,21 +178,27 @@ drwxr-xr-x 6 django_example_ynh django_example_ynh 6 Dec 8 08:37 venv
|
||||||
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
|
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
|
||||||
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
|
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
|
||||||
|
|
||||||
root@yunohost:~# cd /opt/yunohost/django_example_ynh/
|
root@yunohost:~# /home/yunohost.app/django_example/manage.py diffsettings
|
||||||
root@yunohost:/opt/yunohost/django_example_ynh# source venv/bin/activate
|
...
|
||||||
(venv) root@yunohost:/opt/yunohost/django_example_ynh# ./manage.py check
|
root@yunohost:~# /home/yunohost.app/django_example/manage.py check
|
||||||
django_example_ynh v0.8.2 (Django v2.2.17)
|
ENV_TYPE:None
|
||||||
DJANGO_SETTINGS_MODULE='django_example_ynh_demo_settings'
|
PROJECT_PATH:/home/yunohost.app/django_example/venv/lib/python3.9/site-packages
|
||||||
PROJECT_PATH:/opt/yunohost/django_example_ynh/venv/lib/python3.7/site-packages
|
BASE_PATH:/root/django_example
|
||||||
BASE_PATH:/opt/yunohost/django_example_ynh
|
|
||||||
System check identified no issues (0 silenced).
|
System check identified no issues (0 silenced).
|
||||||
|
|
||||||
root@yunohost:~# tail -f /var/log/django_example_ynh/django_example_ynh.log
|
root@yunohost:~# cat /etc/systemd/system/django_example.service
|
||||||
root@yunohost:~# cat /etc/systemd/system/systemd.service
|
|
||||||
...
|
...
|
||||||
|
|
||||||
root@yunohost:~# systemctl reload-or-restart django_example_ynh
|
root@yunohost:~# systemctl reload-or-restart django_example
|
||||||
root@yunohost:~# journalctl --unit=django_example_ynh --follow
|
root@yunohost:~# journalctl --unit=django_example --follow
|
||||||
|
...
|
||||||
|
root@yunohost:~# tail -f /var/log/django_example/django_example.log
|
||||||
|
...
|
||||||
|
root@yunohost:~# tail -f /var/log/nginx/*.log
|
||||||
|
...
|
||||||
|
|
||||||
|
root@yunohost:~# ls -la /etc/nginx/conf.d/
|
||||||
|
root@yunohost:~# cat /etc/nginx/conf.d/$domain.d/django_example.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
# See here for more information
|
|
||||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
|
||||||
|
|
||||||
# Move this file from check_process.default to check_process when you have filled it.
|
|
||||||
|
|
||||||
;; Test complet
|
|
||||||
; Manifest
|
|
||||||
domain="domain.tld" (DOMAIN)
|
|
||||||
path="/path" (PATH)
|
|
||||||
admin="john" (USER)
|
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
|
||||||
password="pass"
|
|
||||||
port="666" (PORT)
|
|
||||||
; Checks
|
|
||||||
pkg_linter=1
|
|
||||||
setup_sub_dir=1
|
|
||||||
setup_root=1
|
|
||||||
setup_nourl=0
|
|
||||||
setup_private=0
|
|
||||||
setup_public=1
|
|
||||||
upgrade=1
|
|
||||||
backup_restore=1
|
|
||||||
multi_instance=1
|
|
||||||
port_already_use=0
|
|
||||||
change_url=1
|
|
||||||
;;; Options
|
|
||||||
Email=
|
|
||||||
Notification=none
|
|
||||||
;;; Upgrade options
|
|
||||||
; commit=CommitHash
|
|
||||||
name=Name and date of the commit.
|
|
||||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
|
||||||
|
|
|
@ -17,4 +17,4 @@ accesslog = '__LOG_FILE__'
|
||||||
errorlog = '__LOG_FILE__'
|
errorlog = '__LOG_FILE__'
|
||||||
|
|
||||||
# https://docs.gunicorn.org/en/latest/settings.html#pidfile
|
# https://docs.gunicorn.org/en/latest/settings.html#pidfile
|
||||||
pidfile = '__FINALPATH__/gunicorn.pid'
|
pidfile = '__DATA_DIR__/gunicorn.pid' # /home/yunohost.app/$app/gunicorn.pid
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!__FINALPATH__/venv/bin/python
|
#!__DATA_DIR__/venv/bin/python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
location __PATH__/static/ {
|
location __PATH__/static/ {
|
||||||
# Service static files by nginx
|
# Service static files by nginx
|
||||||
# e.g.: /var/www/$app/static
|
# e.g.: /var/www/$app/static/
|
||||||
alias __PUBLIC_PATH__/static/;
|
alias __INSTALL_DIR__/static/;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,129 +1,127 @@
|
||||||
asgiref==3.7.2 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
asgiref==3.7.2 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e \
|
--hash=sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e \
|
||||||
--hash=sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed
|
--hash=sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed
|
||||||
async-timeout==4.0.2 ; python_version >= "3.9" and python_full_version <= "3.11.2" \
|
async-timeout==4.0.3 ; python_version >= "3.9" and python_full_version <= "3.11.2" \
|
||||||
--hash=sha256:2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15 \
|
--hash=sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f \
|
||||||
--hash=sha256:8ca1e4fcf50d07413d66d1a5e416e42cfdf5851c981d679a09851a6853383b3c
|
--hash=sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028
|
||||||
bleach==6.0.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
bleach==6.0.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:1a1a85c1595e07d8db14c5f09f09e6433502c51c595970edc090551f0db99414 \
|
--hash=sha256:1a1a85c1595e07d8db14c5f09f09e6433502c51c595970edc090551f0db99414 \
|
||||||
--hash=sha256:33c16e3353dbd13028ab4799a0f89a83f113405c766e9c122df8a06f5b85b3f4
|
--hash=sha256:33c16e3353dbd13028ab4799a0f89a83f113405c766e9c122df8a06f5b85b3f4
|
||||||
bx-django-utils==59 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
bx-django-utils==63 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
||||||
--hash=sha256:179f2098b6966edf4dd157b9d88b5924bcc3ad351513e3606a82015916998bf1 \
|
--hash=sha256:0023c0c18c8ce21fbee0e3bb563cd0283749495ca22cab1857ac971e4ee2bb05 \
|
||||||
--hash=sha256:d6577aabab25736d6cedbf7ccfc2e73b3e863299722e49de2e45bdde4ce24bd3
|
--hash=sha256:3b050d9d9d4e496e082c29d98d7633eb89ad028c658743b0032ee88e7e49be63
|
||||||
bx-py-utils==83 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
bx-py-utils==85 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:192f121f93dd7525a8425b61863bcb2e33f61ad3feb2cde417b46aa4b43fc3c2 \
|
--hash=sha256:8d6ee4bb0c431304b812f5bebb1bc8e2ab05f1b6c2f8d16d352cbcee5e916cd2 \
|
||||||
--hash=sha256:ea8f26db32d8a95cb13876107905cafd859b63d503c37f82d8a7183896adfe70
|
--hash=sha256:df023fa05cda8e969d2cbdb4cc348d8b7670567a2fe775faf7a0c869ec56eaa2
|
||||||
colorama==0.4.6 ; python_version >= "3.9" and python_full_version < "4.0.0" and sys_platform == "win32" \
|
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4" and sys_platform == "win32" \
|
||||||
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
|
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
|
||||||
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
|
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
|
||||||
colorlog==6.7.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
colorlog==6.7.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \
|
--hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \
|
||||||
--hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5
|
--hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5
|
||||||
django-axes==6.0.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
django-axes==6.1.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:0d18cecaae77ad35b11d87f491f38a4d9197efb443438c97ca111e1191eaa473 \
|
--hash=sha256:a7d509dc76e67440839522a182dc63ecafc3bac3af9de6f263d2bcec1154e50e \
|
||||||
--hash=sha256:598de5438615d5d3dea7ef3075ae3236e693c9cbc34721bd313d0f52f613eb92
|
--hash=sha256:e3d44d4ec64ba6d470ef01b6c4b53b6b3747de96821f7c0ef96c64bffa9f6f74
|
||||||
django-example==0.2.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
django-example==0.2.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
||||||
--hash=sha256:2bcaeed97868e8be5c4d7d6a745b054f6983c931d5cefb763e6ff25807f15793 \
|
--hash=sha256:2bcaeed97868e8be5c4d7d6a745b054f6983c931d5cefb763e6ff25807f15793 \
|
||||||
--hash=sha256:469beaa9e4f3e5d0ee98f043ee533f0f01fafef128391ac9f4ca9d9f35290da0
|
--hash=sha256:469beaa9e4f3e5d0ee98f043ee533f0f01fafef128391ac9f4ca9d9f35290da0
|
||||||
django-redis==5.2.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
django-redis==5.3.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:1d037dc02b11ad7aa11f655d26dac3fb1af32630f61ef4428860a2e29ff92026 \
|
--hash=sha256:2d8660d39f586c41c9907d5395693c477434141690fd7eca9d32376af00b0aac \
|
||||||
--hash=sha256:8a99e5582c79f894168f5865c52bd921213253b7fd64d16733ae4591564465de
|
--hash=sha256:8bc5793ec06b28ea802aad85ec437e7646511d4e571e07ccad19cfed8b9ddd44
|
||||||
django-tools==0.54.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
django-tools==0.54.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:5040a91282be9d1c9d379b0c65da50bcb3691bff03cee54fd4123ace238c3a43 \
|
--hash=sha256:5040a91282be9d1c9d379b0c65da50bcb3691bff03cee54fd4123ace238c3a43 \
|
||||||
--hash=sha256:a7b7bfa5b9c5a81966454d17dffb2403cee25a806c858ee0486a08798227598f
|
--hash=sha256:a7b7bfa5b9c5a81966454d17dffb2403cee25a806c858ee0486a08798227598f
|
||||||
django-yunohost-integration[ynh]==0.5.2 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
django-yunohost-integration[ynh]==0.6.0rc4 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:05d96ae0689eb1b8c7bc30e0d247fddb1c18d2845c17a6e4ca533ed47731a4cb \
|
--hash=sha256:290dd7b70e6e85c8ba8db7c13fb0ffcf16f3f66e3e38dcfc46275f2907edc175 \
|
||||||
--hash=sha256:6689115f88dc84acaf94dc01ce940023f566bf933f57115563120912a14cbeff
|
--hash=sha256:dc4a900096e084679c6b250002e0d53138a349e4bbdb96baf868616d3c46f146
|
||||||
django==4.1.9 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
django==4.2.4 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:adae3a952fd86800094ae6f64aa558572e8b4ba8dfe21f0ed8175147e75a72a1 \
|
--hash=sha256:7e4225ec065e0f354ccf7349a22d209de09cc1c074832be9eb84c51c1799c432 \
|
||||||
--hash=sha256:e9f074a84930662104871bfcea55c3c180c50a0a47739db82435deae6cbaf032
|
--hash=sha256:860ae6a138a238fc4f22c99b52f3ead982bb4b1aad8c0122bcd8c8a3a02e409d
|
||||||
gunicorn==20.1.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
gunicorn==21.2.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:9dcc4547dbb1cb284accfb15ab5667a0e5d1881cc443e0677b4882a4067a807e \
|
--hash=sha256:3213aa5e8c24949e792bcacfc176fef362e7aac80b76c56f6b5122bf350722f0 \
|
||||||
--hash=sha256:e0a968b5ba15f8a328fdfd7ab1fcb5af4470c28aaf7e55df02a99bc13138e6e8
|
--hash=sha256:88ec8bff1d634f98e61b9f65bc4bf3cd918a90806c6f5c48bc5603849ec81033
|
||||||
icdiff==2.0.6 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
icdiff==2.0.6 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:a2673b335d671e64fc73c44e1eaa0aa01fd0e68354e58ee17e863ab29912a79a
|
--hash=sha256:a2673b335d671e64fc73c44e1eaa0aa01fd0e68354e58ee17e863ab29912a79a
|
||||||
packaging==23.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
packaging==23.1 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \
|
--hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \
|
||||||
--hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f
|
--hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f
|
||||||
pprintpp==0.4.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
pprintpp==0.4.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d \
|
--hash=sha256:b6b4dcdd0c0c0d75e4d7b2f21a9e933e5b2ce62b26e1a54537f9651ae5a5c01d \
|
||||||
--hash=sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403
|
--hash=sha256:ea826108e2c7f49dc6d66c752973c3fc9749142a798d6b254e1e301cfdbc6403
|
||||||
psycopg2==2.9.6 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
psycopg2==2.9.7 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:11aca705ec888e4f4cea97289a0bf0f22a067a32614f6ef64fcf7b8bfbc53744 \
|
--hash=sha256:1a6a2d609bce44f78af4556bea0c62a5e7f05c23e5ea9c599e07678995609084 \
|
||||||
--hash=sha256:1861a53a6a0fd248e42ea37c957d36950da00266378746588eab4f4b5649e95f \
|
--hash=sha256:44d93a0109dfdf22fe399b419bcd7fa589d86895d3931b01fb321d74dadc68f1 \
|
||||||
--hash=sha256:2362ee4d07ac85ff0ad93e22c693d0f37ff63e28f0615a16b6635a645f4b9214 \
|
--hash=sha256:8275abf628c6dc7ec834ea63f6f3846bf33518907a2b9b693d41fd063767a866 \
|
||||||
--hash=sha256:36c941a767341d11549c0fbdbb2bf5be2eda4caf87f65dfcd7d146828bd27f39 \
|
--hash=sha256:91e81a8333a0037babfc9fe6d11e997a9d4dac0f38c43074886b0d9dead94fe9 \
|
||||||
--hash=sha256:53f4ad0a3988f983e9b49a5d9765d663bbe84f508ed655affdb810af9d0972ad \
|
--hash=sha256:b22ed9c66da2589a664e0f1ca2465c29b75aaab36fa209d4fb916025fb9119e5 \
|
||||||
--hash=sha256:869776630c04f335d4124f120b7fb377fe44b0a7645ab3c34b4ba42516951889 \
|
--hash=sha256:b6bd7d9d3a7a63faae6edf365f0ed0e9b0a1aaf1da3ca146e6b043fb3eb5d723 \
|
||||||
--hash=sha256:a8ad4a47f42aa6aec8d061fdae21eaed8d864d4bb0f0cade5ad32ca16fcd6258 \
|
--hash=sha256:c7949770cafbd2f12cecc97dea410c514368908a103acf519f2a346134caa4d5 \
|
||||||
--hash=sha256:b81fcb9ecfc584f661b71c889edeae70bae30d3ef74fa0ca388ecda50b1222b7 \
|
--hash=sha256:d1210fcf99aae6f728812d1d2240afc1dc44b9e6cba526a06fb8134f969957c2 \
|
||||||
--hash=sha256:d24ead3716a7d093b90b27b3d73459fe8cd90fd7065cf43b3c40966221d8c394 \
|
--hash=sha256:d5c5297e2fbc8068d4255f1e606bfc9291f06f91ec31b2a0d4c536210ac5c0a2 \
|
||||||
--hash=sha256:ded2faa2e6dfb430af7713d87ab4abbfc764d8d7fb73eafe96a24155f906ebf5 \
|
--hash=sha256:e9b04cbef584310a1ac0f0d55bb623ca3244c87c51187645432e342de9ae81a8 \
|
||||||
--hash=sha256:f15158418fd826831b28585e2ab48ed8df2d0d98f502a2b4fe619e7d5ca29011 \
|
--hash=sha256:f00cc35bd7119f1fed17b85bd1007855194dde2cbd8de01ab8ebb17487440ad8
|
||||||
--hash=sha256:f75001a1cbbe523e00b0ef896a5a1ada2da93ccd752b7636db5a99bc57c44494 \
|
python-stdnum==1.19 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
||||||
--hash=sha256:f7a7a5ee78ba7dc74265ba69e010ae89dae635eea0e97b055fb641a01a31d2b1
|
--hash=sha256:133ec82f56390ea74c190569e98f2fb14b869808b1d54785708f22d0fead8b3f \
|
||||||
python-stdnum==1.18 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
--hash=sha256:1b5b401ad3f45b798b0317313b781a433f5d7a5ff2c9feb8054664f76f78644e
|
||||||
--hash=sha256:bcc763d9c49ae23da5d2b7a686d5fd1deec9d9051341160a10d1ac723a26bec0 \
|
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:d7f2a3c7ef4635c957b9cbdd9b1993d1f6ee3a2959f03e172c45440d99f296eb
|
--hash=sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc \
|
||||||
pyyaml==6.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
--hash=sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741 \
|
||||||
--hash=sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf \
|
--hash=sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206 \
|
||||||
--hash=sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293 \
|
--hash=sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27 \
|
||||||
--hash=sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b \
|
--hash=sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595 \
|
||||||
--hash=sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57 \
|
--hash=sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62 \
|
||||||
--hash=sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b \
|
--hash=sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98 \
|
||||||
--hash=sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4 \
|
--hash=sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696 \
|
||||||
--hash=sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07 \
|
--hash=sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d \
|
||||||
--hash=sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba \
|
--hash=sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867 \
|
||||||
--hash=sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9 \
|
--hash=sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47 \
|
||||||
--hash=sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287 \
|
--hash=sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486 \
|
||||||
--hash=sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513 \
|
--hash=sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6 \
|
||||||
--hash=sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0 \
|
--hash=sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3 \
|
||||||
--hash=sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782 \
|
--hash=sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007 \
|
||||||
--hash=sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0 \
|
--hash=sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938 \
|
||||||
--hash=sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92 \
|
--hash=sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c \
|
||||||
--hash=sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f \
|
--hash=sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735 \
|
||||||
--hash=sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2 \
|
--hash=sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d \
|
||||||
--hash=sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc \
|
--hash=sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba \
|
||||||
--hash=sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1 \
|
--hash=sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8 \
|
||||||
--hash=sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c \
|
--hash=sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5 \
|
||||||
--hash=sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86 \
|
--hash=sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd \
|
||||||
--hash=sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4 \
|
--hash=sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3 \
|
||||||
--hash=sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c \
|
--hash=sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0 \
|
||||||
--hash=sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34 \
|
--hash=sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515 \
|
||||||
--hash=sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b \
|
--hash=sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c \
|
||||||
--hash=sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d \
|
--hash=sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c \
|
||||||
--hash=sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c \
|
--hash=sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924 \
|
||||||
--hash=sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb \
|
--hash=sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34 \
|
||||||
--hash=sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7 \
|
--hash=sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43 \
|
||||||
--hash=sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737 \
|
--hash=sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859 \
|
||||||
--hash=sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3 \
|
--hash=sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673 \
|
||||||
--hash=sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d \
|
--hash=sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a \
|
||||||
--hash=sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358 \
|
--hash=sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab \
|
||||||
--hash=sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53 \
|
--hash=sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa \
|
||||||
--hash=sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78 \
|
--hash=sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c \
|
||||||
--hash=sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803 \
|
--hash=sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585 \
|
||||||
--hash=sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a \
|
--hash=sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d \
|
||||||
--hash=sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f \
|
--hash=sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f
|
||||||
--hash=sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174 \
|
redis==5.0.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5
|
--hash=sha256:06570d0b2d84d46c21defc550afbaada381af82f5b83e5b3777600e05d8e2ed0 \
|
||||||
redis==4.5.5 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
--hash=sha256:5cea6c0d335c9a7332a460ed8729ceabb4d0c489c7285b0a86dbbf8a017bd120
|
||||||
--hash=sha256:77929bc7f5dab9adf3acba2d3bb7d7658f1e0c2f1cafe7eb36434e751c471119 \
|
setuptools==68.1.2 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:dc87a0bdef6c8bfe1ef1e1c40be7034390c2ae02d92dcd0c7ca1729443899880
|
--hash=sha256:3d4dfa6d95f1b101d695a6160a7626e15583af71a5f52176efa5d39a054d475d \
|
||||||
setuptools==67.8.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
--hash=sha256:3d8083eed2d13afc9426f227b24fd1659489ec107c0e86cec2ffdde5c92e790b
|
||||||
--hash=sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f \
|
six==1.16.0 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102
|
|
||||||
six==1.16.0 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
|
||||||
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
|
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
|
||||||
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
|
--hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254
|
||||||
sqlparse==0.4.4 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
sqlparse==0.4.4 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3 \
|
--hash=sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3 \
|
||||||
--hash=sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c
|
--hash=sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c
|
||||||
typing-extensions==4.6.3 ; python_version >= "3.9" and python_version < "3.11" \
|
typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "3.11" \
|
||||||
--hash=sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26 \
|
--hash=sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36 \
|
||||||
--hash=sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5
|
--hash=sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2
|
||||||
tzdata==2023.3 ; python_version >= "3.9" and python_full_version < "4.0.0" and sys_platform == "win32" \
|
tzdata==2023.3 ; python_version >= "3.9" and python_version < "4" and sys_platform == "win32" \
|
||||||
--hash=sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a \
|
--hash=sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a \
|
||||||
--hash=sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda
|
--hash=sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda
|
||||||
webencodings==0.5.1 ; python_version >= "3.9" and python_full_version < "4.0.0" \
|
webencodings==0.5.1 ; python_version >= "3.9" and python_version < "4" \
|
||||||
--hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \
|
--hash=sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78 \
|
||||||
--hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923
|
--hash=sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Please do not modify this file, it will be reset at the next update.
|
# Please do not modify this file, it will be reset at the next update.
|
||||||
# You can edit the file __FINALPATH__/local_settings.py and add/modify the settings you need.
|
# You can edit the file __DATA_DIR__/local_settings.py and add/modify the settings you need.
|
||||||
# The parameters you add in local_settings.py will overwrite these,
|
# The parameters you add in local_settings.py will overwrite these,
|
||||||
# but you can use the options and documentation in this file to find out what can be done.
|
# but you can use the options and documentation in this file to find out what can be done.
|
||||||
|
|
||||||
|
@ -22,16 +22,16 @@ from django_example.settings.prod import * # noqa:F401,F403 isort:skip
|
||||||
from django_yunohost_integration.base_settings import LOGGING # noqa:F401 isort:skip
|
from django_yunohost_integration.base_settings import LOGGING # noqa:F401 isort:skip
|
||||||
|
|
||||||
|
|
||||||
FINALPATH = __Path('__FINALPATH__') # /opt/yunohost/$app
|
DATA_DIR_PATH = __Path('__DATA_DIR__') # /home/yunohost.app/$app/
|
||||||
assert FINALPATH.is_dir(), f'Directory not exists: {FINALPATH}'
|
assert DATA_DIR_PATH.is_dir(), f'Directory not exists: {DATA_DIR_PATH}'
|
||||||
|
|
||||||
PUBLIC_PATH = __Path('__PUBLIC_PATH__') # /var/www/$app
|
INSTALL_DIR_PATH = __Path('__INSTALL_DIR__') # /var/www/$app/
|
||||||
assert PUBLIC_PATH.is_dir(), f'Directory not exists: {PUBLIC_PATH}'
|
assert INSTALL_DIR_PATH.is_dir(), f'Directory not exists: {INSTALL_DIR_PATH}'
|
||||||
|
|
||||||
LOG_FILE = __Path('__LOG_FILE__') # /var/log/$app/django_example_ynh.log
|
LOG_FILE_PATH = __Path('__LOG_FILE__') # /var/log/$app/django_example_ynh.log
|
||||||
assert LOG_FILE.is_file(), f'File not exists: {LOG_FILE}'
|
assert LOG_FILE_PATH.is_file(), f'File not exists: {LOG_FILE_PATH}'
|
||||||
|
|
||||||
PATH_URL = '__PATH_URL__' # $YNH_APP_ARG_PATH
|
PATH_URL = '__PATH__'
|
||||||
PATH_URL = PATH_URL.strip('/')
|
PATH_URL = PATH_URL.strip('/')
|
||||||
|
|
||||||
YNH_CURRENT_HOST = '__YNH_CURRENT_HOST__' # YunoHost main domain from: /etc/yunohost/current_host
|
YNH_CURRENT_HOST = '__YNH_CURRENT_HOST__' # YunoHost main domain from: /etc/yunohost/current_host
|
||||||
|
@ -40,7 +40,7 @@ YNH_CURRENT_HOST = '__YNH_CURRENT_HOST__' # YunoHost main domain from: /etc/yun
|
||||||
# config_panel.toml settings:
|
# config_panel.toml settings:
|
||||||
|
|
||||||
DEBUG_ENABLED = '__DEBUG_ENABLED__'
|
DEBUG_ENABLED = '__DEBUG_ENABLED__'
|
||||||
DEBUG = bool(int(DEBUG_ENABLED))
|
DEBUG = DEBUG_ENABLED == 'YES'
|
||||||
|
|
||||||
LOG_LEVEL = '__LOG_LEVEL__'
|
LOG_LEVEL = '__LOG_LEVEL__'
|
||||||
ADMIN_EMAIL = '__ADMIN_EMAIL__'
|
ADMIN_EMAIL = '__ADMIN_EMAIL__'
|
||||||
|
@ -52,7 +52,9 @@ DEFAULT_FROM_EMAIL = '__DEFAULT_FROM_EMAIL__'
|
||||||
# Function that will be called to finalize a user profile:
|
# Function that will be called to finalize a user profile:
|
||||||
YNH_SETUP_USER = 'setup_user.setup_project_user'
|
YNH_SETUP_USER = 'setup_user.setup_project_user'
|
||||||
|
|
||||||
SECRET_KEY = __get_or_create_secret(FINALPATH / 'secret.txt') # /opt/yunohost/$app/secret.txt
|
SECRET_KEY = __get_or_create_secret(
|
||||||
|
DATA_DIR_PATH / 'secret.txt'
|
||||||
|
) # /home/yunohost.app/$app/secret.txt
|
||||||
|
|
||||||
INSTALLED_APPS += [
|
INSTALLED_APPS += [
|
||||||
'axes', # https://github.com/jazzband/django-axes
|
'axes', # https://github.com/jazzband/django-axes
|
||||||
|
@ -150,14 +152,14 @@ else:
|
||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
|
|
||||||
STATIC_ROOT = str(PUBLIC_PATH / 'static')
|
STATIC_ROOT = str(INSTALL_DIR_PATH / 'static')
|
||||||
MEDIA_ROOT = str(PUBLIC_PATH / 'media')
|
MEDIA_ROOT = str(INSTALL_DIR_PATH / 'media')
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
# Set log file to e.g.: /var/log/$app/$app.log
|
# Set log file to e.g.: /var/log/$app/$app.log
|
||||||
LOGGING['handlers']['log_file']['filename'] = str(LOG_FILE)
|
LOGGING['handlers']['log_file']['filename'] = str(LOG_FILE_PATH)
|
||||||
|
|
||||||
# Example how to add logging to own app:
|
# Example how to add logging to own app:
|
||||||
LOGGING['loggers']['django_example'] = {
|
LOGGING['loggers']['django_example'] = {
|
||||||
|
|
|
@ -5,9 +5,9 @@ After=redis.service postgresql.service
|
||||||
[Service]
|
[Service]
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__DATA_DIR__/
|
||||||
|
|
||||||
ExecStart=__FINALPATH__/venv/bin/gunicorn --config __FINALPATH__/gunicorn.conf.py wsgi
|
ExecStart=__DATA_DIR__/venv/bin/gunicorn --config __DATA_DIR__/gunicorn.conf.py wsgi
|
||||||
|
|
||||||
StandardOutput=syslog
|
StandardOutput=syslog
|
||||||
StandardError=syslog
|
StandardError=syslog
|
||||||
|
|
|
@ -17,7 +17,7 @@ from django.views.generic import RedirectView
|
||||||
|
|
||||||
|
|
||||||
if settings.PATH_URL:
|
if settings.PATH_URL:
|
||||||
# settings.PATH_URL is the $YNH_APP_ARG_PATH
|
# settings.PATH_URL is the $YNH_APP_ARG_PATH_URL
|
||||||
# Prefix all urls with "PATH_URL":
|
# Prefix all urls with "PATH_URL":
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', RedirectView.as_view(url=f'{settings.PATH_URL}/')),
|
path('', RedirectView.as_view(url=f'{settings.PATH_URL}/')),
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
# https://github.com/YunoHost/example_ynh/blob/master/config_panel.toml.example
|
|
||||||
|
|
||||||
version = "1.0"
|
|
||||||
|
|
||||||
[main]
|
|
||||||
name.en = "Main configuration"
|
|
||||||
name.fr = "Configuration principale"
|
|
||||||
services = ["__APP__"]
|
|
||||||
|
|
||||||
[main.config]
|
|
||||||
name = "Configuration Options"
|
|
||||||
|
|
||||||
[main.config.default_from_email]
|
|
||||||
ask = "from email"
|
|
||||||
type = "email"
|
|
||||||
help = "Default email address to use for various automated emails."
|
|
||||||
bind = "default_from_email:__FINALPATH__/settings.py"
|
|
||||||
|
|
||||||
[main.config.admin_email]
|
|
||||||
ask = "ADMIN email"
|
|
||||||
type = "email"
|
|
||||||
help = "EMail address for error emails."
|
|
||||||
bind = "admin_email:__FINALPATH__/settings.py"
|
|
||||||
|
|
||||||
[main.config.debug_enabled]
|
|
||||||
ask = "DEBUG mode"
|
|
||||||
type = "boolean"
|
|
||||||
yes = "1"
|
|
||||||
no = "0"
|
|
||||||
help = "Should be never enabled in production!"
|
|
||||||
bind = "debug_enabled:__FINALPATH__/settings.py"
|
|
||||||
|
|
||||||
[main.config.log_level]
|
|
||||||
type = "string"
|
|
||||||
ask = "Log Level"
|
|
||||||
choices = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
|
|
||||||
default = "WARNING"
|
|
||||||
bind = "log_level:__FINALPATH__/settings.py"
|
|
|
@ -6,9 +6,9 @@ and urls made for YunoHost installation.
|
||||||
|
|
||||||
e.g.:
|
e.g.:
|
||||||
```bash
|
```bash
|
||||||
~$ git clone https://github.com/YunoHost-Apps/django_example_ynh.git
|
~$ git clone https://github.com/YunoHost-Apps/django_example.git
|
||||||
~$ cd django_example_ynh/
|
~$ cd django_example_ynh/
|
||||||
~/django_example_ynh$ make
|
~/django_example$ make
|
||||||
install-poetry install or update poetry
|
install-poetry install or update poetry
|
||||||
install install project via poetry
|
install install project via poetry
|
||||||
update update the sources and installation and generate "conf/requirements.txt"
|
update update the sources and installation and generate "conf/requirements.txt"
|
||||||
|
@ -21,9 +21,9 @@ publish Release new version to PyPi
|
||||||
local-test Run local_test.py to run the project locally
|
local-test Run local_test.py to run the project locally
|
||||||
local-diff-settings Run "manage.py diffsettings" with local test
|
local-diff-settings Run "manage.py diffsettings" with local test
|
||||||
|
|
||||||
~/django_example_ynh$ make install-poetry
|
~/django_example$ make install-poetry
|
||||||
~/django_example_ynh$ make install
|
~/django_example$ make install
|
||||||
~/django_example_ynh$ make local-test
|
~/django_example$ make local-test
|
||||||
```
|
```
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
@ -35,48 +35,48 @@ Notes:
|
||||||
|
|
||||||
## history
|
## history
|
||||||
|
|
||||||
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.2.0...master) **dev**
|
* [compare v0.1.5...master](https://github.com/YunoHost-Apps/django_example/compare/v0.2.0...master) **dev**
|
||||||
* tbc
|
* tbc
|
||||||
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.5...v0.2.0)
|
* [v0.2.0 - 15.09.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.5...v0.2.0)
|
||||||
* rename/split `django_example_ynh` into:
|
* rename/split `django_example_ynh` into:
|
||||||
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
|
* [django_yunohost_integration](https://github.com/jedie/django_yunohost_integration) - Python package with the glue code to integrate a Django project with YunoHost
|
||||||
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example_ynh) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
|
* [django_example_ynh](https://github.com/YunoHost-Apps/django_example) - Demo YunoHost App to demonstrate the integration of a Django project under YunoHost
|
||||||
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.4...v0.1.5)
|
* [v0.1.5 - 19.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.4...v0.1.5)
|
||||||
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
|
* Make some deps `gunicorn`, `psycopg2-binary`, `django-redis`, `django-axes` optional
|
||||||
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.3...v0.1.4)
|
* [v0.1.4 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.3...v0.1.4)
|
||||||
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example_ynh/issues/7)
|
* Bugfix [CSRF verification failed on POST requests #7](https://github.com/YunoHost-Apps/django_example/issues/7)
|
||||||
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.2...v0.1.3)
|
* [v0.1.3 - 08.01.2021](https://github.com/YunoHost-Apps/django_example/compare/v0.1.2...v0.1.3)
|
||||||
* set "DEBUG = True" in local_test (so static files are served and auth works)
|
* set "DEBUG = True" in local_test (so static files are served and auth works)
|
||||||
* Bugfixes and cleanups
|
* Bugfixes and cleanups
|
||||||
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.1...v0.1.2)
|
* [v0.1.2 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.1...v0.1.2)
|
||||||
* Bugfixes
|
* Bugfixes
|
||||||
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/v0.1.0...v0.1.1)
|
* [v0.1.1 - 29.12.2020](https://github.com/YunoHost-Apps/django_example/compare/v0.1.0...v0.1.1)
|
||||||
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
|
* Refactor "create_superuser" to a manage command, useable via "django_example_ynh" in `INSTALLED_APPS`
|
||||||
* Generate "conf/requirements.txt" and use this file for install
|
* Generate "conf/requirements.txt" and use this file for install
|
||||||
* rename own settings and urls (in `/conf/`)
|
* rename own settings and urls (in `/conf/`)
|
||||||
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/compare/f578f14...v0.1.0)
|
* [v0.1.0 - 28.12.2020](https://github.com/YunoHost-Apps/django_example/compare/f578f14...v0.1.0)
|
||||||
* first working state
|
* first working state
|
||||||
* [23.12.2020](https://github.com/YunoHost-Apps/django_example_ynh/commit/f578f144a3a6d11d7044597c37d550d29c247773)
|
* [23.12.2020](https://github.com/YunoHost-Apps/django_example/commit/f578f144a3a6d11d7044597c37d550d29c247773)
|
||||||
* init the project
|
* init the project
|
||||||
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example_ynh
|
* Report a bug about this package: https://github.com/YunoHost-Apps/django_example
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
* PyPi package: https://pypi.org/project/django-ynh/
|
* PyPi package: https://pypi.org/project/django-ynh/
|
||||||
|
|
||||||
These projects used `django_example_ynh`:
|
These projects used `django_example_ynh`:
|
||||||
|
|
||||||
* https://github.com/YunoHost-Apps/django_example_ynh
|
* https://github.com/YunoHost-Apps/django_example
|
||||||
* https://github.com/YunoHost-Apps/django-for-runners_ynh
|
* https://github.com/YunoHost-Apps/django-for-runners_ynh
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Developer info
|
# Developer info
|
||||||
|
|
||||||
The App project will be stored under `__FINALPATH__` (e.g.: `/opt/yunohost/$app`) that's Django's `settings.FINALPATH`
|
The App project will be stored under `__DATA_DIR__` (e.g.: `/home/yunohost.app/$app/`) that's Django's `settings.DATA_DIR_PATH`
|
||||||
"static" / "media" files to serve via nginx are under `__PUBLIC_PATH__` (e.g.: `/var/www/$app`) that's `settings.PUBLIC_PATH`
|
"static" / "media" files to serve via nginx are under `__INSTALL_DIR__` (e.g.: `/var/www/$app/`) that's `settings.INSTALL_DIR_PATH`
|
||||||
|
|
||||||
## package installation / debugging
|
## package installation / debugging
|
||||||
|
|
||||||
|
@ -89,38 +89,46 @@ To update:
|
||||||
```bash
|
```bash
|
||||||
~# cd django_example_ynh
|
~# cd django_example_ynh
|
||||||
~/django_example_ynh# git fetch && git reset --hard origin/testing
|
~/django_example_ynh# git fetch && git reset --hard origin/testing
|
||||||
~/django_example_ynh# yunohost app upgrade django_example_ynh -u . -F
|
~/django_example_ynh# yunohost app upgrade django_example -u . -F
|
||||||
```
|
```
|
||||||
|
|
||||||
To remove call e.g.:
|
To remove call e.g.:
|
||||||
```bash
|
```bash
|
||||||
sudo yunohost app remove django_example_ynh
|
sudo yunohost app remove django_example
|
||||||
```
|
```
|
||||||
|
|
||||||
Backup / remove / restore cycle, e.g.:
|
Backup / remove / restore cycle, e.g.:
|
||||||
```bash
|
```bash
|
||||||
yunohost backup create --apps django_example_ynh
|
yunohost backup create --apps django_example
|
||||||
yunohost backup list
|
yunohost backup list
|
||||||
archives:
|
archives:
|
||||||
- django_example_ynh-pre-upgrade1
|
- django_example_ynh-pre-upgrade1
|
||||||
- 20201223-163434
|
- 20230822-062848
|
||||||
yunohost app remove django_example_ynh
|
yunohost app remove django_example
|
||||||
yunohost backup restore 20201223-163434 --apps django_example_ynh
|
yunohost backup restore 20230822-062848 --apps django_example
|
||||||
```
|
```
|
||||||
|
|
||||||
Debug the installation, e.g.:
|
Debug the installation, e.g.:
|
||||||
```bash
|
```bash
|
||||||
root@yunohost:~# cat /etc/yunohost/apps/django_example_ynh/settings.yml
|
root@yunohost:~# cat /etc/yunohost/apps/django_example/settings.yml
|
||||||
|
...
|
||||||
|
app: django_example
|
||||||
|
...
|
||||||
|
data_dir: /home/yunohost.app/django_example
|
||||||
|
...
|
||||||
|
install_dir: /var/www/django_example
|
||||||
|
...
|
||||||
|
log_file: /var/log/django_example/django_example.log
|
||||||
...
|
...
|
||||||
|
|
||||||
root@yunohost:~# ls -la /var/www/django_example_ynh/
|
root@yunohost:~# ls -la /var/www/django_example/
|
||||||
total 18
|
total 18
|
||||||
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
||||||
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
||||||
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
||||||
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
||||||
|
|
||||||
root@yunohost:~# ls -la /opt/yunohost/django_example_ynh/
|
root@yunohost:~# ls -la /home/yunohost.app/django_example/
|
||||||
total 58
|
total 58
|
||||||
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
|
drwxr-xr-x 5 django_example_ynh django_example_ynh 11 Dec 8 08:39 .
|
||||||
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
||||||
|
@ -132,21 +140,27 @@ drwxr-xr-x 6 django_example_ynh django_example_ynh 6 Dec 8 08:37 venv
|
||||||
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
|
-rw-r--r-- 1 django_example_ynh django_example_ynh 115 Dec 8 08:39 wsgi.py
|
||||||
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
|
-rw-r--r-- 1 django_example_ynh django_example_ynh 4737 Dec 8 08:39 django_example_ynh_demo_settings.py
|
||||||
|
|
||||||
root@yunohost:~# cd /opt/yunohost/django_example_ynh/
|
root@yunohost:~# /home/yunohost.app/django_example/manage.py diffsettings
|
||||||
root@yunohost:/opt/yunohost/django_example_ynh# source venv/bin/activate
|
...
|
||||||
(venv) root@yunohost:/opt/yunohost/django_example_ynh# ./manage.py check
|
root@yunohost:~# /home/yunohost.app/django_example/manage.py check
|
||||||
django_example_ynh v0.8.2 (Django v2.2.17)
|
ENV_TYPE:None
|
||||||
DJANGO_SETTINGS_MODULE='django_example_ynh_demo_settings'
|
PROJECT_PATH:/home/yunohost.app/django_example/venv/lib/python3.9/site-packages
|
||||||
PROJECT_PATH:/opt/yunohost/django_example_ynh/venv/lib/python3.7/site-packages
|
BASE_PATH:/root/django_example
|
||||||
BASE_PATH:/opt/yunohost/django_example_ynh
|
|
||||||
System check identified no issues (0 silenced).
|
System check identified no issues (0 silenced).
|
||||||
|
|
||||||
root@yunohost:~# tail -f /var/log/django_example_ynh/django_example_ynh.log
|
root@yunohost:~# cat /etc/systemd/system/django_example.service
|
||||||
root@yunohost:~# cat /etc/systemd/system/systemd.service
|
|
||||||
...
|
...
|
||||||
|
|
||||||
root@yunohost:~# systemctl reload-or-restart django_example_ynh
|
root@yunohost:~# systemctl reload-or-restart django_example
|
||||||
root@yunohost:~# journalctl --unit=django_example_ynh --follow
|
root@yunohost:~# journalctl --unit=django_example --follow
|
||||||
|
...
|
||||||
|
root@yunohost:~# tail -f /var/log/django_example/django_example.log
|
||||||
|
...
|
||||||
|
root@yunohost:~# tail -f /var/log/nginx/*.log
|
||||||
|
...
|
||||||
|
|
||||||
|
root@yunohost:~# ls -la /etc/nginx/conf.d/
|
||||||
|
root@yunohost:~# cat /etc/nginx/conf.d/$domain.d/django_example.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Django Example",
|
|
||||||
"id": "django_example",
|
|
||||||
"packaging_format": 1,
|
|
||||||
"description": {
|
|
||||||
"en": "Demo YunoHost Application to demonstrate the integration of a Django project",
|
|
||||||
"fr": "Démonstration d'intégration d'un projet Django dand YunoHost"
|
|
||||||
},
|
|
||||||
"version": "0.2.0~ynh1",
|
|
||||||
"url": "https://github.com/YunoHost-Apps/django_example_ynh",
|
|
||||||
"upstream": {
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"website": "https://github.com/YunoHost-Apps/django_example_ynh",
|
|
||||||
"admindoc": "https://github.com/YunoHost-Apps/django_example_ynh",
|
|
||||||
"userdoc": "https://github.com/jedie/django-example",
|
|
||||||
"code": "https://github.com/YunoHost-Apps/django_example_ynh"
|
|
||||||
},
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"maintainer": {
|
|
||||||
"name": "Jens Diemer",
|
|
||||||
"email": "django_example_ynh@jensdiemer.de"
|
|
||||||
},
|
|
||||||
"previous_maintainers": [],
|
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">=11"
|
|
||||||
},
|
|
||||||
"multi_instance": true,
|
|
||||||
"services": [
|
|
||||||
"nginx", "postgresql", "redis"
|
|
||||||
],
|
|
||||||
"arguments": {
|
|
||||||
"install" : [
|
|
||||||
{
|
|
||||||
"name": "domain",
|
|
||||||
"type": "domain"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"type": "path",
|
|
||||||
"example": "/django_example_ynh",
|
|
||||||
"default": "/django_example_ynh"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_public",
|
|
||||||
"type": "boolean",
|
|
||||||
"help": {
|
|
||||||
"en": "Any YunoHost user and anonymous people from the web will be able to access the application",
|
|
||||||
"fr": "Tout utilisateur YunoHost et les personnes anonymes pourront accéder à l'application"
|
|
||||||
},
|
|
||||||
"default": false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
110
manifest.toml
Normal file
110
manifest.toml
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
# https://yunohost.org/en/packaging_manifest
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "django_example"
|
||||||
|
name = "Django Example"
|
||||||
|
description.en = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost."
|
||||||
|
|
||||||
|
version = "0.2.0~ynh2"
|
||||||
|
|
||||||
|
maintainers = ["Jens Diemer"]
|
||||||
|
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
# https://yunohost.org/en/packaging_manifest#upstream-section
|
||||||
|
license = "GPL-3.0"
|
||||||
|
website = "https://github.com/YunoHost-Apps/django_example_ynh"
|
||||||
|
admindoc = "https://github.com/YunoHost-Apps/django_example_ynh"
|
||||||
|
userdoc = "https://github.com/jedie/django-example"
|
||||||
|
code = "https://github.com/YunoHost-Apps/django_example_ynh"
|
||||||
|
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
# https://yunohost.org/en/packaging_manifest#integration-section
|
||||||
|
yunohost = ">=11"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = true
|
||||||
|
ldap = true
|
||||||
|
sso = true
|
||||||
|
disk = "50M" # **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||||
|
ram.build = "50M" # **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
ram.runtime = "50M" # **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||||
|
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
# setting $path and template variable __PATH__
|
||||||
|
type = "path"
|
||||||
|
default = "/django_example_ynh"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||||
|
type = "user"
|
||||||
|
default = "admin"
|
||||||
|
|
||||||
|
[install.init_main_permission]
|
||||||
|
type = "group"
|
||||||
|
default = "admins"
|
||||||
|
|
||||||
|
[install.default_from_email] # __DEFAULT_FROM_EMAIL__
|
||||||
|
ask.en = "Default email address to use for various automated emails."
|
||||||
|
type = "email"
|
||||||
|
example = "admin@example.com"
|
||||||
|
|
||||||
|
[install.admin_email] # __ADMIN_EMAIL__
|
||||||
|
ask.en = "EMail address for error emails."
|
||||||
|
type = "email"
|
||||||
|
example = "admin@example.com"
|
||||||
|
|
||||||
|
[install.debug_enabled] # __DEBUG_ENABLED__
|
||||||
|
ask.en = "Should be never enabled in production!"
|
||||||
|
type = "select"
|
||||||
|
choices = ["YES", "NO"]
|
||||||
|
default = "NO"
|
||||||
|
|
||||||
|
[install.log_level] # __LOG_LEVEL__
|
||||||
|
ask.en = "Logging level"
|
||||||
|
type = "select"
|
||||||
|
choices = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
|
||||||
|
default = "WARNING"
|
||||||
|
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.system_user]
|
||||||
|
# This will provision/deprovision a unix system user
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
# https://yunohost.org/en/packaging_apps_resources#install-dir
|
||||||
|
# This will create/remove the install dir as /var/www/$app/
|
||||||
|
# and store the corresponding setting $install_dir and template variable __INSTALL_DIR__
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
# https://yunohost.org/en/packaging_apps_resources#data-dir
|
||||||
|
# This will create/remove the data dir as /home/yunohost.app/$app/
|
||||||
|
# and store the corresponding setting $data_dir and template variable __DATA_DIR__
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
# https://yunohost.org/en/packaging_apps_resources#permissions
|
||||||
|
# This will configure SSOwat permission for $domain/$path/
|
||||||
|
# The initial allowed group of user is configured via the init_main_permission question (public=visitors, private=all_users)
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
# https://yunohost.org/en/packaging_apps_resources#ports
|
||||||
|
# This will pick a random port for reverse-proxying and store it as the $port setting
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
# https://yunohost.org/en/packaging_apps_resources#apt
|
||||||
|
# This will automatically install/uninstall the following apt packages
|
||||||
|
packages = "build-essential, python3-dev, python3-pip, python3-venv, git, libpq-dev, postgresql, postgresql-contrib"
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
# https://yunohost.org/en/packaging_apps_resources#database
|
||||||
|
# This will automatically provision/deprovison a Postgres DB
|
||||||
|
# and store the corresponding credentials in settings $db_user, $db_name, $db_pwd
|
||||||
|
type = "postgresql"
|
844
poetry.lock
generated
844
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "django_example_ynh"
|
name = "django_example_ynh"
|
||||||
version = "0.2.0+ynh1"
|
version = "0.2.0+ynh2"
|
||||||
description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost."
|
description = "Demo YunoHost Application to demonstrate the integration of a Django project under YunoHost."
|
||||||
authors = ["Jens Diemer <django_example_ynh@jensdiemer.de>"]
|
authors = ["Jens Diemer <django_example_ynh@jensdiemer.de>"]
|
||||||
homepage = "https://github.com/YunoHost-Apps/django_example_ynh"
|
homepage = "https://github.com/YunoHost-Apps/django_example_ynh"
|
||||||
|
@ -17,10 +17,11 @@ django_example = ">=0.1.0rc0" # https://github.com/jedie/django-example
|
||||||
#
|
#
|
||||||
# extras "ynh" will install: gunicorn, psycopg2, django-redis and django-axes
|
# extras "ynh" will install: gunicorn, psycopg2, django-redis and django-axes
|
||||||
# see: https://github.com/YunoHost-Apps/django_yunohost_integration/blob/main/pyproject.toml
|
# see: https://github.com/YunoHost-Apps/django_yunohost_integration/blob/main/pyproject.toml
|
||||||
django_yunohost_integration = {version = ">=0.5.1", extras = ["ynh"]} # https://github.com/YunoHost-Apps/django_yunohost_integration
|
django_yunohost_integration = {version = ">=0.6.0rc4", extras = ["ynh"]} # https://github.com/YunoHost-Apps/django_yunohost_integration
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
cli-base-utilities = "*" # https://github.com/jedie/cli-base-utilities
|
||||||
bx_py_utils = "*" # https://github.com/boxine/bx_py_utils
|
bx_py_utils = "*" # https://github.com/boxine/bx_py_utils
|
||||||
bx_django_utils = "*" # https://github.com/boxine/bx_django_utils
|
bx_django_utils = "*" # https://github.com/boxine/bx_django_utils
|
||||||
tox = "*" # https://github.com/tox-dev/tox
|
tox = "*" # https://github.com/tox-dev/tox
|
||||||
|
|
|
@ -4,13 +4,6 @@
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
# Transfer the main SSO domain to the App:
|
# Transfer the main SSO domain to the App:
|
||||||
ynh_current_host=$(cat /etc/yunohost/current_host)
|
ynh_current_host=$(cat /etc/yunohost/current_host)
|
||||||
__YNH_CURRENT_HOST__=${ynh_current_host}
|
__YNH_CURRENT_HOST__=${ynh_current_host}
|
||||||
|
@ -20,7 +13,7 @@ __YNH_CURRENT_HOST__=${ynh_current_host}
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# 'debug_enabled' -> '__DEBUG_ENABLED__' -> settings.DEBUG
|
# 'debug_enabled' -> '__DEBUG_ENABLED__' -> settings.DEBUG
|
||||||
debug_enabled="0"
|
debug_enabled="NO" # "YES" or "NO" string
|
||||||
|
|
||||||
# 'log_level' -> '__LOG_LEVEL__' -> settings.LOG_LEVEL
|
# 'log_level' -> '__LOG_LEVEL__' -> settings.LOG_LEVEL
|
||||||
log_level="WARNING"
|
log_level="WARNING"
|
||||||
|
@ -35,17 +28,62 @@ default_from_email="${app}@${domain}"
|
||||||
# SET CONSTANTS
|
# SET CONSTANTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
public_path=/var/www/$app
|
# e.g.: point pip cache to: /home/yunohost.app/$app/.cache/
|
||||||
final_path=/opt/yunohost/$app
|
XDG_CACHE_HOME="$data_dir/.cache/"
|
||||||
|
|
||||||
log_path=/var/log/$app
|
log_path=/var/log/$app
|
||||||
log_file="${log_path}/${app}.log"
|
log_file="${log_path}/${app}.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
myynh_setup_python_venv() {
|
||||||
pkg_dependencies="build-essential python3-dev python3-pip python3-venv git libpq-dev postgresql postgresql-contrib"
|
# Always recreate everything fresh with current python version
|
||||||
|
ynh_secure_remove "$data_dir/venv"
|
||||||
|
|
||||||
|
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
|
||||||
|
python3 -m venv --without-pip "$data_dir/venv"
|
||||||
|
|
||||||
|
chown -c -R "$app:" "$data_dir"
|
||||||
|
|
||||||
|
# run source in a 'sub shell'
|
||||||
|
(
|
||||||
|
set +o nounset
|
||||||
|
source "$data_dir/venv/bin/activate"
|
||||||
|
set -o nounset
|
||||||
|
set -x
|
||||||
|
ynh_exec_as $app $data_dir/venv/bin/python3 -m ensurepip
|
||||||
|
ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade wheel pip setuptools
|
||||||
|
ynh_exec_as $app $data_dir/venv/bin/pip3 install --no-deps -r "$data_dir/requirements.txt"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
myynh_setup_log_file() {
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$log_file")"
|
||||||
|
touch "$log_file"
|
||||||
|
|
||||||
|
chown -c -R $app:$app "$log_path"
|
||||||
|
chmod -c o-rwx "$log_path"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
myynh_fix_file_permissions() {
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
|
||||||
|
# /var/www/$app/
|
||||||
|
chown -c -R "$app:www-data" "$install_dir"
|
||||||
|
chmod -c o-rwx "$install_dir"
|
||||||
|
|
||||||
|
# /home/yunohost.app/$app/
|
||||||
|
chown -c -R "$app:" "$data_dir"
|
||||||
|
chmod -c o-rwx "$data_dir"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Redis HELPERS
|
# Redis HELPERS
|
||||||
|
|
|
@ -9,21 +9,6 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Loading installation settings..."
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|
||||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -33,8 +18,11 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
# /var/www/$app/
|
||||||
ynh_backup --src_path="$public_path"
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
|
# /home/yunohost.app/$app/
|
||||||
|
ynh_backup --src_path="$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -6,81 +6,9 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
YNH_APP_ARG_DOMAIN=$YNH_APP_NEW_DOMAIN
|
|
||||||
YNH_APP_ARG_PATH=$YNH_APP_NEW_PATH
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
|
||||||
new_path=$YNH_APP_NEW_PATH
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
admin=$(ynh_app_setting_get --app="$app" --key=admin)
|
|
||||||
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|
||||||
log_path=$(ynh_app_setting_get --app="$app" --key=log_path)
|
|
||||||
|
|
||||||
port=$(ynh_app_setting_get --app="$app" --key=port)
|
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
|
||||||
db_user=$db_name
|
|
||||||
|
|
||||||
redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
|
||||||
# config_panel.toml settings:
|
|
||||||
|
|
||||||
debug_enabled=$(ynh_app_setting_get --app="$app" --key=debug_enabled)
|
|
||||||
log_level=$(ynh_app_setting_get --app="$app" --key=log_level)
|
|
||||||
admin_email=$(ynh_app_setting_get --app="$app" --key=admin_email)
|
|
||||||
default_from_email=$(ynh_app_setting_get --app="$app" --key=default_from_email)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=40
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
change_domain=0
|
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
|
||||||
then
|
|
||||||
change_domain=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -88,66 +16,31 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping systemd service '$app'..."
|
ynh_script_progression --message="Stopping systemd service '$app'..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="$log_file"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating nginx web server configuration..."
|
ynh_script_progression --message="Updating nginx web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
# Change the path in the nginx config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original nginx config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
|
||||||
# Set global variables for nginx helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config "public_path" "port"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for nginx
|
|
||||||
if [ $change_domain -eq 1 ]
|
|
||||||
then
|
|
||||||
# Delete file checksum for the old conf file location
|
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
|
||||||
# Store file checksum for the new config file location
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# UPDATE DJANGO SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY SETTINGS
|
ynh_script_progression --message="Update $app settings file..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Modify $app config file..."
|
|
||||||
|
|
||||||
domain=$YNH_APP_NEW_DOMAIN
|
path=$new_path
|
||||||
path_url=$YNH_APP_NEW_PATH
|
domain=$new_domain
|
||||||
|
|
||||||
ynh_add_config --template="settings.py" --destination="$final_path/settings.py"
|
ynh_add_config --template="settings.py" --destination="$data_dir/settings.py"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$log_file"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading nginx web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
228
scripts/install
228
scripts/install
|
@ -7,159 +7,93 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
# Install parameters are automatically saved as settings
|
||||||
# MANAGE SCRIPT FAILURE
|
#
|
||||||
#=================================================
|
# Settings are automatically loaded as bash variables
|
||||||
|
# in every app script context, therefore typically these will exist:
|
||||||
|
# - $domain
|
||||||
|
# - $path
|
||||||
|
# - $language
|
||||||
|
# ... etc
|
||||||
|
#
|
||||||
|
# Resources defined in the manifest are provisioned prior to this script
|
||||||
|
# and corresponding settings are also available, such as:
|
||||||
|
# - $install_dir
|
||||||
|
# - $port
|
||||||
|
# - $db_name
|
||||||
|
# ...
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
#
|
||||||
ynh_abort_if_errors
|
# $app is the app id (i.e. 'example' for first install,
|
||||||
|
# or 'example__2', '__3', ... for multi-instance installs)
|
||||||
|
#
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETTINGS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
|
|
||||||
|
# Logging:
|
||||||
|
log_file="/var/log/$app/$app.log"
|
||||||
|
ynh_app_setting_set --app=$app --key=log_file --value="$log_file"
|
||||||
|
|
||||||
|
# Redis:
|
||||||
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
|
ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
||||||
|
|
||||||
|
# App settings:
|
||||||
|
ynh_app_setting_set --app=$app --key=default_from_email --value="$default_from_email"
|
||||||
|
ynh_app_setting_set --app=$app --key=admin_email --value="$admin_email"
|
||||||
|
ynh_app_setting_set --app=$app --key=debug_enabled --value="$debug_enabled"
|
||||||
|
ynh_app_setting_set --app=$app --key=log_level --value="$log_level"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
|
|
||||||
# Path for e.g. "static" files, served by nginx:
|
mkdir -p "$install_dir/media" "$install_dir/static"
|
||||||
test ! -e "$public_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Path for own config files, e.g.: Django's settings.py:
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url"
|
|
||||||
|
|
||||||
mkdir -p "$public_path/media" "$public_path/static"
|
|
||||||
mkdir -p "$final_path"
|
|
||||||
|
|
||||||
mkdir -p "$log_path"
|
|
||||||
touch "${log_file}"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# SETUP LOG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Setup logging..."
|
||||||
|
|
||||||
ynh_app_setting_set --app="$app" --key=admin --value="$admin"
|
myynh_setup_log_file
|
||||||
ynh_app_setting_set --app="$app" --key=public_path --value="$public_path"
|
|
||||||
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
|
|
||||||
ynh_app_setting_set --app="$app" --key=log_path --value="$log_file"
|
|
||||||
|
|
||||||
ynh_app_setting_set --app="$app" --key=domain --value="$domain"
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_app_setting_set --app="$app" --key=path --value="$path_url"
|
ynh_use_logrotate --logfile="$log_file" --specific_user=$app
|
||||||
|
|
||||||
# Find a free port
|
|
||||||
port=$(ynh_find_port --port=8000)
|
|
||||||
# Set port as application setting
|
|
||||||
# https://yunohost.org/en/contribute/packaging_apps/helpers
|
|
||||||
# https://github.com/YunoHost/yunohost/blob/dev/helpers/setting
|
|
||||||
ynh_app_setting_set --app="$app" --key=port --value="$port"
|
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
|
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
|
||||||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
|
||||||
# config_panel.toml settings:
|
|
||||||
|
|
||||||
ynh_app_setting_set --app="$app" --key=debug_enabled --value="$debug_enabled"
|
|
||||||
ynh_app_setting_set --app="$app" --key=log_level --value="$log_level"
|
|
||||||
ynh_app_setting_set --app="$app" --key=admin_email --value="$admin_email"
|
|
||||||
ynh_app_setting_set --app="$app" --key=default_from_email --value="$default_from_email"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing $app dependencies..." --weight=20
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A PostgreSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
|
||||||
db_user=$db_name
|
|
||||||
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
|
|
||||||
# Initialize database and store postgres password for upgrade
|
|
||||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring nginx web server..."
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
# https://yunohost.org/en/contribute/packaging_apps/helpers
|
|
||||||
# https://github.com/YunoHost/yunohost/blob/dev/helpers/nginx
|
|
||||||
ynh_add_nginx_config "public_path" "port"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring system user '$app'..."
|
|
||||||
|
|
||||||
# A home directory for venv and settings etc.
|
|
||||||
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PYTHON VIRTUALENV
|
# PYTHON VIRTUALENV
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create Python virtualenv..." --weight=5
|
ynh_script_progression --message="Create and setup Python virtualenv..." --weight=45
|
||||||
|
cp ../conf/requirements.txt "$data_dir/requirements.txt"
|
||||||
# Always recreate everything fresh with current python version
|
myynh_setup_python_venv
|
||||||
ynh_secure_remove "${final_path}/venv"
|
|
||||||
|
|
||||||
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
|
|
||||||
python3 -m venv --without-pip "${final_path}/venv"
|
|
||||||
|
|
||||||
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PIP INSTALLATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Install project via pip..." --weight=45
|
|
||||||
|
|
||||||
#run source in a 'sub shell'
|
|
||||||
(
|
|
||||||
set +o nounset
|
|
||||||
source "${final_path}/venv/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
|
|
||||||
)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# copy config files
|
# copy config files
|
||||||
# ================================================
|
# ================================================
|
||||||
ynh_script_progression --message="Create $app configuration files..."
|
ynh_script_progression --message="Create $app configuration files..."
|
||||||
|
|
||||||
ynh_add_config --template="gunicorn.conf.py" --destination="$final_path/gunicorn.conf.py"
|
ynh_add_config --template="gunicorn.conf.py" --destination="$data_dir/gunicorn.conf.py"
|
||||||
|
|
||||||
ynh_add_config --template="manage.py" --destination="$final_path/manage.py"
|
ynh_add_config --template="manage.py" --destination="$data_dir/manage.py"
|
||||||
chmod +x "$final_path/manage.py"
|
chmod -c +x "$data_dir/manage.py"
|
||||||
|
|
||||||
ynh_add_config --template="settings.py" --destination="$final_path/settings.py"
|
ynh_add_config --template="settings.py" --destination="$data_dir/settings.py"
|
||||||
ynh_add_config --template="setup_user.py" --destination="$final_path/setup_user.py"
|
ynh_add_config --template="setup_user.py" --destination="$data_dir/setup_user.py"
|
||||||
ynh_add_config --template="urls.py" --destination="$final_path/urls.py"
|
ynh_add_config --template="urls.py" --destination="$data_dir/urls.py"
|
||||||
ynh_add_config --template="wsgi.py" --destination="$final_path/wsgi.py"
|
ynh_add_config --template="wsgi.py" --destination="$data_dir/wsgi.py"
|
||||||
|
|
||||||
touch "$final_path/local_settings.py"
|
touch "$data_dir/local_settings.py"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
# MIGRATE / COLLECTSTATIC / CREATEADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
||||||
|
|
||||||
cd "$final_path" || exit
|
cd "$data_dir" || exit
|
||||||
|
|
||||||
# Just for debugging:
|
# Just for debugging:
|
||||||
./manage.py diffsettings
|
./manage.py diffsettings
|
||||||
|
@ -174,72 +108,46 @@ cd "$final_path" || exit
|
||||||
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
|
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
|
||||||
./manage.py check --deploy || true
|
./manage.py check --deploy || true
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring log rotation..."
|
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
|
||||||
ynh_use_logrotate "$log_file"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="${log_file}"
|
yunohost service add $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Set file permissions..."
|
||||||
# Set permissions to app files
|
myynh_fix_file_permissions
|
||||||
chown -R "$app:" "$log_path"
|
|
||||||
chown -R "$app:www-data" "$public_path"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
chmod o-rwx "$log_path"
|
|
||||||
chmod o-rwx "$public_path"
|
|
||||||
chmod o-rwx "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Configuring systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
# https://yunohost.org/en/contribute/packaging_apps/helpers
|
# https://yunohost.org/en/packaging_apps_helpers#ynh-add-systemd-config
|
||||||
# https://github.com/YunoHost/yunohost/blob/dev/helpers/systemd
|
# https://github.com/YunoHost/yunohost/blob/dev/helpers/systemd
|
||||||
ynh_add_systemd_config --service="$app" --template="systemd.service"
|
ynh_add_systemd_config --service=$app --template="systemd.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring SSOwat..."
|
|
||||||
|
|
||||||
# Make app public if necessary or protect it
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
# Everyone can access the app.
|
|
||||||
# The "main" permission is automatically created before the install script.
|
|
||||||
ynh_permission_update --permission "main" --add "visitors"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Start the app server via systemd
|
# Start the app server via systemd
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$log_file"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading nginx web server..."
|
ynh_script_progression --message="Configuring nginx web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="nginx" --action="reload"
|
# Create a dedicated nginx config
|
||||||
|
# https://yunohost.org/en/contribute/packaging_apps/helpers
|
||||||
|
# https://github.com/YunoHost/yunohost/blob/dev/helpers/nginx
|
||||||
|
ynh_add_nginx_config "public_path" "port"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -9,17 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|
||||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -27,10 +16,10 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
# Remove a service from the admin panel, added by `yunohost service add`
|
||||||
if yunohost service status "$app" >/dev/null 2>&1
|
if yunohost service status $app >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..."
|
ynh_script_progression --message="Removing $app service integration..."
|
||||||
yunohost service remove "$app"
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -38,15 +27,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Stopping and removing systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_remove_systemd_config --service="$app"
|
ynh_remove_systemd_config --service=$app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE THE PostgreSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
|
||||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|
||||||
|
|
||||||
##=================================================
|
##=================================================
|
||||||
## REMOVE REDIS DB
|
## REMOVE REDIS DB
|
||||||
|
@ -54,22 +35,16 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
ynh_redis_remove_db
|
ynh_redis_remove_db
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=10
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
ynh_exec_warn_less ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..."
|
ynh_script_progression --message="Removing app main directory..."
|
||||||
|
|
||||||
# Remove the app directory securely
|
# /var/www/$app/
|
||||||
ynh_secure_remove --file="$public_path"
|
ynh_secure_remove --file="$install_dir"
|
||||||
ynh_secure_remove --file="$final_path"
|
|
||||||
|
# /home/yunohost.app/$app/
|
||||||
|
ynh_secure_remove --file="$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
@ -87,16 +62,6 @@ ynh_script_progression --message="Removing logrotate configuration..."
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
|
||||||
|
|
||||||
# Delete a system user
|
|
||||||
ynh_system_user_delete --username="$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
106
scripts/restore
106
scripts/restore
|
@ -9,39 +9,12 @@
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading settings..."
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|
||||||
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
|
|
||||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
|
||||||
db_user=$db_name
|
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
|
||||||
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
@ -50,74 +23,31 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring $app main directory..."
|
ynh_script_progression --message="Restoring $app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$final_path"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
ynh_restore_file --origin_path="$public_path"
|
ynh_restore_file --origin_path="$data_dir"
|
||||||
|
|
||||||
#=================================================
|
ynh_script_progression --message="Set file permissions..."
|
||||||
# RECREATE THE DEDICATED USER
|
myynh_fix_file_permissions
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE USER RIGHTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Restore permissions on app files
|
|
||||||
chown -R "$app:www-data" "$public_path"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC RESTORATION
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=20
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PYTHON VIRTUALENV
|
# PYTHON VIRTUALENV
|
||||||
# Maybe the backup contains a other Python version
|
# Maybe the backup contains a other Python version
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreate Python virtualenv..." --weight=5
|
ynh_script_progression --message="Create and setup Python virtualenv..." --weight=45
|
||||||
|
|
||||||
# Always recreate everything fresh with current python version
|
myynh_setup_python_venv
|
||||||
ynh_secure_remove "${final_path}/venv"
|
|
||||||
|
|
||||||
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
|
|
||||||
python3 -m venv --without-pip "${final_path}/venv"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PIP INSTALLATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Install project via pip..." --weight=45
|
|
||||||
#run source in a 'sub shell'
|
|
||||||
(
|
|
||||||
set +o nounset
|
|
||||||
source "${final_path}/venv/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
|
|
||||||
)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PostgreSQL DATABASE
|
# RESTORE THE PostgreSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
|
|
||||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
ynh_script_progression --message="Restoring the systemd $app configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
@ -127,15 +57,14 @@ systemctl enable $app.service --quiet
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add $app --log="${log_file}"
|
yunohost service add $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setup logging..."
|
||||||
|
|
||||||
mkdir -p "$log_path"
|
myynh_setup_log_file
|
||||||
touch "${log_file}"
|
|
||||||
chown -R "$app:" "$log_path"
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,15 +72,8 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Set file permissions..."
|
||||||
# Set permissions to app files
|
myynh_fix_file_permissions
|
||||||
chown -R "$app:" "$log_path"
|
|
||||||
chown -R "$app:www-data" "$public_path"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
chmod o-rwx "$log_path"
|
|
||||||
chmod o-rwx "$public_path"
|
|
||||||
chmod o-rwx "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -160,7 +82,7 @@ chmod o-rwx "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$log_file"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
150
scripts/upgrade
150
scripts/upgrade
|
@ -7,68 +7,29 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# LOAD SETTINGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
admin=$(ynh_app_setting_get --app="$app" --key=admin)
|
|
||||||
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|
||||||
log_path=$(ynh_app_setting_get --app="$app" --key=log_path)
|
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
|
||||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
|
||||||
|
|
||||||
port=$(ynh_app_setting_get --app="$app" --key=port)
|
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
|
||||||
db_user=$db_name
|
|
||||||
|
|
||||||
redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
|
||||||
|
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
# config_panel.toml settings:
|
# config_panel.toml settings:
|
||||||
|
|
||||||
debug_enabled=$(ynh_app_setting_get --app="$app" --key=debug_enabled)
|
|
||||||
if [ -z "$debug_enabled" ]; then
|
if [ -z "$debug_enabled" ]; then
|
||||||
debug_enabled="0"
|
debug_enabled="0"
|
||||||
ynh_app_setting_set --app="$app" --key=debug_enabled --value="$debug_enabled"
|
ynh_app_setting_set --app=$app --key=debug_enabled --value="$debug_enabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_level=$(ynh_app_setting_get --app="$app" --key=log_level)
|
|
||||||
if [ -z "$log_level" ]; then
|
if [ -z "$log_level" ]; then
|
||||||
log_level="WARNING"
|
log_level="WARNING"
|
||||||
ynh_app_setting_set --app="$app" --key=log_level --value="$log_level"
|
ynh_app_setting_set --app=$app --key=log_level --value="$log_level"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
admin_email=$(ynh_app_setting_get --app="$app" --key=admin_email)
|
|
||||||
if [ -z "$admin_email" ]; then
|
if [ -z "$admin_email" ]; then
|
||||||
admin_email="${admin}@${domain}"
|
admin_email="${admin}@${domain}"
|
||||||
ynh_app_setting_set --app="$app" --key=admin_email --value="$admin_email"
|
ynh_app_setting_set --app=$app --key=admin_email --value="$admin_email"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
default_from_email=$(ynh_app_setting_get --app="$app" --key=default_from_email)
|
|
||||||
if [ -z "$default_from_email" ]; then
|
if [ -z "$default_from_email" ]; then
|
||||||
default_from_email="${app}@${domain}"
|
default_from_email="${app}@${domain}"
|
||||||
ynh_app_setting_set --app="$app" --key=default_from_email --value="$default_from_email"
|
ynh_app_setting_set --app=$app --key=default_from_email --value="$default_from_email"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=40
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,91 +37,44 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Stopping systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop"
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="$log_file"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading nginx web server configuration..."
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
# https://yunohost.org/en/contribute/packaging_apps/helpers
|
|
||||||
# https://github.com/YunoHost/yunohost/blob/dev/helpers/nginx
|
|
||||||
ynh_add_nginx_config "public_path" "port"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
|
||||||
# Update dependencies
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=20
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Configuring systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_add_systemd_config --service="$app" --template="systemd.service"
|
ynh_add_systemd_config --service=$app --template="systemd.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PYTHON VIRTUALENV
|
# PYTHON VIRTUALENV
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreate Python virtualenv..." --weight=5
|
ynh_script_progression --message="Create and setup Python virtualenv..." --weight=45
|
||||||
|
cp ../conf/requirements.txt "$data_dir/requirements.txt"
|
||||||
# Always recreate everything fresh with current python version
|
myynh_setup_python_venv
|
||||||
ynh_secure_remove "${final_path}/venv"
|
|
||||||
|
|
||||||
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
|
|
||||||
python3 -m venv --without-pip "${final_path}/venv"
|
|
||||||
|
|
||||||
cp ../conf/requirements.txt "$final_path/requirements.txt"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PIP INSTALLATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Install project via pip..." --weight=45
|
|
||||||
#run source in a 'sub shell'
|
|
||||||
(
|
|
||||||
set +o nounset
|
|
||||||
source "${final_path}/venv/bin/activate"
|
|
||||||
set -o nounset
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools
|
|
||||||
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
|
|
||||||
)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# copy config files
|
# copy config files
|
||||||
# ================================================
|
# ================================================
|
||||||
ynh_script_progression --message="Create project configuration files..."
|
ynh_script_progression --message="Create project configuration files..."
|
||||||
|
|
||||||
ynh_add_config --template="gunicorn.conf.py" --destination="$final_path/gunicorn.conf.py"
|
ynh_add_config --template="gunicorn.conf.py" --destination="$data_dir/gunicorn.conf.py"
|
||||||
|
|
||||||
ynh_add_config --template="manage.py" --destination="$final_path/manage.py"
|
ynh_add_config --template="manage.py" --destination="$data_dir/manage.py"
|
||||||
chmod +x "$final_path/manage.py"
|
chmod -c +x "$data_dir/manage.py"
|
||||||
|
|
||||||
ynh_add_config --template="settings.py" --destination="$final_path/settings.py"
|
ynh_add_config --template="settings.py" --destination="$data_dir/settings.py"
|
||||||
ynh_add_config --template="setup_user.py" --destination="$final_path/setup_user.py"
|
ynh_add_config --template="setup_user.py" --destination="$data_dir/setup_user.py"
|
||||||
ynh_add_config --template="urls.py" --destination="$final_path/urls.py"
|
ynh_add_config --template="urls.py" --destination="$data_dir/urls.py"
|
||||||
ynh_add_config --template="wsgi.py" --destination="$final_path/wsgi.py"
|
ynh_add_config --template="wsgi.py" --destination="$data_dir/wsgi.py"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MIGRATE PYINVENTORY
|
# MIGRATE PYINVENTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
ynh_script_progression --message="migrate/collectstatic/createadmin..." --weight=10
|
||||||
|
|
||||||
cd "$final_path" || exit
|
cd "$data_dir" || exit
|
||||||
|
|
||||||
# Just for debugging:
|
# Just for debugging:
|
||||||
./manage.py diffsettings
|
./manage.py diffsettings
|
||||||
|
@ -182,43 +96,23 @@ cd "$final_path" || exit
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --logfile="$log_file" --specific_user=$app --non-append
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
||||||
|
|
||||||
yunohost service add $app --log="${log_file}"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Set file permissions..."
|
||||||
# Set permissions to app files
|
myynh_fix_file_permissions
|
||||||
chown -R "$app:" "$log_path"
|
|
||||||
chown -R "$app:www-data" "$public_path"
|
|
||||||
chown -R "$app:" "$final_path"
|
|
||||||
|
|
||||||
chmod o-rwx "$log_path"
|
|
||||||
chmod o-rwx "$public_path"
|
|
||||||
chmod o-rwx "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Start the app server via systemd
|
# Start the app server via systemd
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
ynh_script_progression --message="Starting systemd service '$app'..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
yunohost service add $app
|
||||||
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$log_file"
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading nginx web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
31
tests.toml
Normal file
31
tests.toml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
# NB: the tests to run are automatically deduced by the CI script according to the
|
||||||
|
# content of the app's manifest. The declarations below allow to customize which
|
||||||
|
# tests are ran, possibly add special test suite to test special args, or
|
||||||
|
# declare which commits to test upgrade from.
|
||||||
|
#
|
||||||
|
# You can also decide (though this is discouraged!) to ban/ignore some tests,
|
||||||
|
|
||||||
|
# The test IDs to be used in only/exclude statements are:
|
||||||
|
# install.root, install.subdir, install.nourl, install.multi, backup_restore, upgrade, upgrade.someCommitId change_url
|
||||||
|
#exclude = ["install.private", "install.multi"]
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Default args to use for install
|
||||||
|
# -------------------------------
|
||||||
|
|
||||||
|
# By default, the CI will automagically fill the 'standard' args
|
||||||
|
# such as domain, path, admin, is_public and password with relevant values
|
||||||
|
# and also install args with a "default" provided in the manifest..
|
||||||
|
# It should only make sense to declare custom args here for args with no default values
|
||||||
|
|
||||||
|
args.default_from_email = "default_from_email@example.tld"
|
||||||
|
args.admin_email = "admin_email@example.tld"
|
||||||
|
|
|
@ -11,7 +11,7 @@ import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import django
|
import django
|
||||||
from django_yunohost_integration.local_test import create_local_test
|
from django_yunohost_integration.local_test import CreateResults, create_local_test
|
||||||
|
|
||||||
|
|
||||||
BASE_PATH = Path(__file__).parent.parent
|
BASE_PATH = Path(__file__).parent.parent
|
||||||
|
@ -21,23 +21,23 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
|
||||||
|
|
||||||
def pytest_configure():
|
def pytest_configure():
|
||||||
print('Compile YunoHost files...')
|
print('Compile YunoHost files...')
|
||||||
final_path = create_local_test(
|
result: CreateResults = create_local_test(
|
||||||
django_settings_path=BASE_PATH / 'conf' / 'settings.py',
|
django_settings_path=BASE_PATH / 'conf' / 'settings.py',
|
||||||
destination=BASE_PATH / 'local_test',
|
destination=BASE_PATH / 'local_test',
|
||||||
runserver=False,
|
runserver=False,
|
||||||
extra_replacements={
|
extra_replacements={
|
||||||
'__DEBUG_ENABLED__': '0',
|
'__DEBUG_ENABLED__': 'NO', # "YES" or "NO" string
|
||||||
'__LOG_LEVEL__': 'INFO',
|
'__LOG_LEVEL__': 'INFO',
|
||||||
'__ADMIN_EMAIL__': 'foo-bar@test.tld',
|
'__ADMIN_EMAIL__': 'foo-bar@test.tld',
|
||||||
'__DEFAULT_FROM_EMAIL__': 'django_app@test.tld',
|
'__DEFAULT_FROM_EMAIL__': 'django_app@test.tld',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
print('Local test files created here:')
|
print('Local test files created:')
|
||||||
print(f'"{final_path}"')
|
print(result)
|
||||||
|
|
||||||
os.chdir(final_path)
|
os.chdir(result.data_dir_path)
|
||||||
final_home_str = str(final_path)
|
data_dir = str(result.data_dir_path)
|
||||||
if final_home_str not in sys.path:
|
if data_dir not in sys.path:
|
||||||
sys.path.insert(0, final_home_str)
|
sys.path.insert(0, data_dir)
|
||||||
|
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
|
@ -19,15 +19,15 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase):
|
||||||
def test_settings(self):
|
def test_settings(self):
|
||||||
assert settings.PATH_URL == 'app_path'
|
assert settings.PATH_URL == 'app_path'
|
||||||
|
|
||||||
assert str(settings.FINALPATH).endswith('/local_test/opt_yunohost')
|
assert str(settings.DATA_DIR_PATH).endswith('/local_test/opt_yunohost')
|
||||||
assert str(settings.PUBLIC_PATH).endswith('/local_test/var_www')
|
assert str(settings.INSTALL_DIR_PATH).endswith('/local_test/var_www')
|
||||||
assert str(settings.LOG_FILE).endswith('/local_test/var_log_django_example.log')
|
assert str(settings.LOG_FILE_PATH).endswith('/local_test/var_log_django_example.log')
|
||||||
|
|
||||||
assert settings.ROOT_URLCONF == 'urls'
|
assert settings.ROOT_URLCONF == 'urls'
|
||||||
|
|
||||||
def test_config_panel_settings(self):
|
def test_config_panel_settings(self):
|
||||||
# config_panel.toml settings, set via tests.conftest.pytest_configure():
|
# config_panel.toml settings, set via tests.conftest.pytest_configure():
|
||||||
assert settings.DEBUG_ENABLED == '0' and settings.DEBUG is False
|
assert settings.DEBUG_ENABLED == 'NO' and settings.DEBUG is False
|
||||||
assert settings.LOG_LEVEL == 'INFO'
|
assert settings.LOG_LEVEL == 'INFO'
|
||||||
assert settings.ADMIN_EMAIL == 'foo-bar@test.tld'
|
assert settings.ADMIN_EMAIL == 'foo-bar@test.tld'
|
||||||
assert settings.DEFAULT_FROM_EMAIL == 'django_app@test.tld'
|
assert settings.DEFAULT_FROM_EMAIL == 'django_app@test.tld'
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- END Header -->
|
<!-- END Header -->
|
||||||
<div class="breadcrumbs">
|
<nav aria-label="Breadcrumbs">
|
||||||
<a href="/app_path/admin/">
|
<div class="breadcrumbs">
|
||||||
Home
|
<a href="/app_path/admin/">
|
||||||
</a>
|
Home
|
||||||
</div>
|
</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
<div class="main" id="main">
|
<div class="main" id="main">
|
||||||
<div class="content">
|
<div class="content" id="content-start" tabindex="-1">
|
||||||
<!-- Content -->
|
<!-- Content -->
|
||||||
<div class="colM" id="content">
|
<div class="colM" id="content">
|
||||||
<h2>
|
<h2>
|
||||||
|
|
|
@ -42,8 +42,8 @@ def test_version():
|
||||||
manifest_version = pyproject_version.replace('+', '~')
|
manifest_version = pyproject_version.replace('+', '~')
|
||||||
|
|
||||||
assert_file_contains_string(
|
assert_file_contains_string(
|
||||||
file_path=Path(PACKAGE_ROOT, 'manifest.json'),
|
file_path=Path(PACKAGE_ROOT, 'manifest.toml'),
|
||||||
string=f'"version": "{manifest_version}"',
|
string=f'version = "{manifest_version}"',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue