mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
commit
0ae2f590b9
32 changed files with 512 additions and 1105 deletions
103
README.md
103
README.md
|
@ -21,7 +21,7 @@ Seafile is an open Source Cloud Storage application.
|
|||
It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk.
|
||||
|
||||
|
||||
**Shipped version:** 9.0.2~ynh2
|
||||
**Shipped version:** 9.0.9~ynh1
|
||||
|
||||
**Demo:** https://demo.seafile.com
|
||||
|
||||
|
@ -36,112 +36,11 @@ It's a Enterprise file sync and share platform with high reliability and perform
|
|||
![Screenshot of Seafile](./doc/screenshots/sharing-dialog.png)
|
||||
![Screenshot of Seafile](./doc/screenshots/sync-client.jpg)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
### Multi-users support
|
||||
|
||||
This app support LDAP and the SSO authentification.
|
||||
|
||||
If you have Seafile installed before 7.x and you have more than one domain for users in Yunohost or Seafile app is installed on a different domain, you need to migrate your accounts.
|
||||
You can use the provided action at https://domain.tld/yunohost/admin/#/apps/seafile/actions. You can also use this following command to migrate all of your accounts:
|
||||
```
|
||||
yunohost app action run seafile migrate_user_email_to_mail_email
|
||||
```
|
||||
See [issue#44](https://github.com/YunoHost-Apps/seafile_ynh/issues/44)
|
||||
for more information.
|
||||
|
||||
### Supported architectures
|
||||
|
||||
Since seafile 6.3 the i386 architecture is no more supported.
|
||||
|
||||
Seafile don't distribute binary for generic armhf architectures but rpi binary generally work on all arm board.
|
||||
|
||||
<!--Limitations
|
||||
------------
|
||||
|
||||
* Any known limitations.-->
|
||||
|
||||
Additional informations
|
||||
-----------------------
|
||||
|
||||
### Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/seafile_ynh/issues
|
||||
* App website: https://www.seafile.com
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
### Install
|
||||
|
||||
From command line:
|
||||
|
||||
`yunohost app install seafile`
|
||||
|
||||
### Upgrade
|
||||
|
||||
By default a backup is made before the upgrade. To avoid this you have theses following possibilites:
|
||||
- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade synapse`.
|
||||
- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command:
|
||||
|
||||
`yunohost app setting synapse disable_backup_before_upgrade -v 1`
|
||||
|
||||
After this settings will be applied for **all** next upgrade.
|
||||
|
||||
From command line:
|
||||
|
||||
`yunohost app upgrade seafile`
|
||||
|
||||
### Backup
|
||||
|
||||
This app use now the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration is recommended to proceed like this:
|
||||
|
||||
- Stop seafile service with theses following command:
|
||||
|
||||
`systemctl stop seafile.service seahub.service`
|
||||
|
||||
- Launch the backup of seafile with this following command:
|
||||
|
||||
`yunohost backup create --app seafile`
|
||||
|
||||
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is stored in `/home/yunohost.app/seafile-data`.
|
||||
- Restart the seafile service with theses command:
|
||||
|
||||
`systemctl start seafile.service seahub.service`
|
||||
|
||||
### Remove
|
||||
|
||||
Due of the backup core only feature the data directory in `/home/yunohost.app/seafile-data` **is not removed**. It need to be removed manually to purge app user data.
|
||||
|
||||
### Change URL
|
||||
|
||||
Since now it's possible to change domain or the url of seafile.
|
||||
|
||||
To do this run : `yunohost app change-url seafile -d new_domain.tld -p PATH new_path`
|
||||
|
||||
Developers infos
|
||||
----------------
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/seafile_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade seafile -u https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
- Find a way to fix the issue https://github.com/YunoHost-Apps/seafile_ynh/issues/5
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://www.seafile.com>
|
||||
* Official admin documentation: <https://manual.seafile.com>
|
||||
* Upstream app code repository: <https://github.com/haiwen/seafile-server>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_seafile>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/seafile_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
|
103
README_fr.md
103
README_fr.md
|
@ -21,7 +21,7 @@ Seafile is an open Source Cloud Storage application.
|
|||
It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk.
|
||||
|
||||
|
||||
**Version incluse :** 9.0.2~ynh2
|
||||
**Version incluse :** 9.0.9~ynh1
|
||||
|
||||
**Démo :** https://demo.seafile.com
|
||||
|
||||
|
@ -36,112 +36,11 @@ It's a Enterprise file sync and share platform with high reliability and perform
|
|||
![Capture d’écran de Seafile](./doc/screenshots/sharing-dialog.png)
|
||||
![Capture d’écran de Seafile](./doc/screenshots/sync-client.jpg)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
### Multi-users support
|
||||
|
||||
This app support LDAP and the SSO authentification.
|
||||
|
||||
If you have Seafile installed before 7.x and you have more than one domain for users in Yunohost or Seafile app is installed on a different domain, you need to migrate your accounts.
|
||||
You can use the provided action at https://domain.tld/yunohost/admin/#/apps/seafile/actions. You can also use this following command to migrate all of your accounts:
|
||||
```
|
||||
yunohost app action run seafile migrate_user_email_to_mail_email
|
||||
```
|
||||
See [issue#44](https://github.com/YunoHost-Apps/seafile_ynh/issues/44)
|
||||
for more information.
|
||||
|
||||
### Supported architectures
|
||||
|
||||
Since seafile 6.3 the i386 architecture is no more supported.
|
||||
|
||||
Seafile don't distribute binary for generic armhf architectures but rpi binary generally work on all arm board.
|
||||
|
||||
<!--Limitations
|
||||
------------
|
||||
|
||||
* Any known limitations.-->
|
||||
|
||||
Additional informations
|
||||
-----------------------
|
||||
|
||||
### Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/seafile_ynh/issues
|
||||
* App website: https://www.seafile.com
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
### Install
|
||||
|
||||
From command line:
|
||||
|
||||
`yunohost app install seafile`
|
||||
|
||||
### Upgrade
|
||||
|
||||
By default a backup is made before the upgrade. To avoid this you have theses following possibilites:
|
||||
- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade synapse`.
|
||||
- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command:
|
||||
|
||||
`yunohost app setting synapse disable_backup_before_upgrade -v 1`
|
||||
|
||||
After this settings will be applied for **all** next upgrade.
|
||||
|
||||
From command line:
|
||||
|
||||
`yunohost app upgrade seafile`
|
||||
|
||||
### Backup
|
||||
|
||||
This app use now the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration is recommended to proceed like this:
|
||||
|
||||
- Stop seafile service with theses following command:
|
||||
|
||||
`systemctl stop seafile.service seahub.service`
|
||||
|
||||
- Launch the backup of seafile with this following command:
|
||||
|
||||
`yunohost backup create --app seafile`
|
||||
|
||||
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is stored in `/home/yunohost.app/seafile-data`.
|
||||
- Restart the seafile service with theses command:
|
||||
|
||||
`systemctl start seafile.service seahub.service`
|
||||
|
||||
### Remove
|
||||
|
||||
Due of the backup core only feature the data directory in `/home/yunohost.app/seafile-data` **is not removed**. It need to be removed manually to purge app user data.
|
||||
|
||||
### Change URL
|
||||
|
||||
Since now it's possible to change domain or the url of seafile.
|
||||
|
||||
To do this run : `yunohost app change-url seafile -d new_domain.tld -p PATH new_path`
|
||||
|
||||
Developers infos
|
||||
----------------
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/seafile_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade seafile -u https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
- Find a way to fix the issue https://github.com/YunoHost-Apps/seafile_ynh/issues/5
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://www.seafile.com>
|
||||
* Documentation officielle de l’admin : <https://manual.seafile.com>
|
||||
* Dépôt de code officiel de l’app : <https://github.com/haiwen/seafile-server>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_seafile>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/seafile_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
|
11
actions.json
11
actions.json
|
@ -1,13 +1,4 @@
|
|||
[{
|
||||
"id": "migrate_user_email_to_mail_email",
|
||||
"name": "Migrate all user email with seafile domain to main user email",
|
||||
"command": "bash scripts/actions",
|
||||
"user": "root",
|
||||
"accepted_return_codes": [0],
|
||||
"description": {
|
||||
"en": "Hight level function : Change automatically the email for the user authentication to a the main user email. This function should be run when you migrate from seafile 6 to seafile 7.\nBy example 'toto@seafile-domain.tld' will be renamed to the new email 'toto-main-email@main-yunohost-domain.tld'. Note that when do you this change the email need to be also changed in all client !!"
|
||||
}
|
||||
},
|
||||
[
|
||||
{
|
||||
"id": "change_user_email",
|
||||
"name": "Change user email of user",
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
;; Nom du test
|
||||
auto_remove=1
|
||||
# Commentaire ignoré
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
server_name="Seafile"
|
||||
admin="john" (USER)
|
||||
admin_password="Sup3rS3cr3t" (PASSWORD)
|
||||
is_public="1" (PUBLIC|public=1|private=0)
|
||||
public_site="1" (PUBLIC|public=1|private=0)
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=3ce35d35ca4a8bac9b3d49d900af6a2b41577f9a
|
||||
upgrade=1 from_commit=97c0b2f6548c2e415641533c4746682747eacb94
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
wrong_user=1
|
||||
wrong_path=1
|
||||
incorrect_path=1
|
||||
corrupt_source=1
|
||||
fail_download_source=1
|
||||
port_already_use=1 (8000)
|
||||
final_path_already_use=1
|
||||
change_url=1
|
||||
|
||||
;;; Upgrade options
|
||||
; commit=3ce35d35ca4a8bac9b3d49d900af6a2b41577f9a
|
||||
name=Version 7.1 Old version for CI 4 branch
|
||||
; commit=97c0b2f6548c2e415641533c4746682747eacb94
|
||||
name=Version 8.x Old version for CI 5 branch
|
|
@ -1,11 +0,0 @@
|
|||
SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_9.0.2_x86-64.tar.gz
|
||||
SOURCE_SUM=5adb3c800cd48de38b6e5d9b073e03ff375cfa30208a7291c481cdf1e1cf167b
|
||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# default: sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
# (Optional) Archive format
|
||||
# default: tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
# (Optional) Put false if sources are directly in the archive root
|
||||
# default: true
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -1,11 +0,0 @@
|
|||
SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz
|
||||
SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53
|
||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# default: sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
# (Optional) Archive format
|
||||
# default: tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
# (Optional) Put false if sources are directly in the archive root
|
||||
# default: true
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -1,11 +0,0 @@
|
|||
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v9.0.2/seafile-server-9.0.2-buster-arm64v8l.tar.gz
|
||||
SOURCE_SUM=0332a57364f92eaefe0109e5a65f8e3a3b909c3805b9113431d4bde2a962d78c
|
||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# default: sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
# (Optional) Archive format
|
||||
# default: tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
# (Optional) Put false if sources are directly in the archive root
|
||||
# default: true
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -1,11 +0,0 @@
|
|||
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz
|
||||
SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db
|
||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# default: sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
# (Optional) Archive format
|
||||
# default: tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
# (Optional) Put false if sources are directly in the archive root
|
||||
# default: true
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -1,11 +0,0 @@
|
|||
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v9.0.2/seafile-server-9.0.2-buster-arm32v7l.tar.gz
|
||||
SOURCE_SUM=2aa42caa1420842435ee8a386fb9f3244a0d286a4c1f829a97cba49b41b274df
|
||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# default: sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
# (Optional) Archive format
|
||||
# default: tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
# (Optional) Put false if sources are directly in the archive root
|
||||
# default: true
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -1,11 +0,0 @@
|
|||
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz
|
||||
SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db
|
||||
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||
# default: sha256
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
# (Optional) Archive format
|
||||
# default: tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
# (Optional) Put false if sources are directly in the archive root
|
||||
# default: true
|
||||
SOURCE_IN_SUBDIR=true
|
17
conf/ccnet.conf
Normal file
17
conf/ccnet.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
[General]
|
||||
SERVICE_URL = https://__DOMAIN____PATH__
|
||||
|
||||
[Database]
|
||||
ENGINE = mysql
|
||||
HOST = 127.0.0.1
|
||||
PORT = 3306
|
||||
USER = __DB_USER__
|
||||
PASSWD = __DB_PWD__
|
||||
DB = ccnetdb
|
||||
CONNECTION_CHARSET = utf8
|
||||
|
||||
[LDAP]
|
||||
HOST = ldap://localhost:389
|
||||
BASE = ou=users,dc=yunohost,dc=org
|
||||
LOGIN_ATTR = mail
|
||||
FILTER = permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org
|
|
@ -14,5 +14,5 @@
|
|||
enabled = true
|
||||
port = http,https
|
||||
filter = seafile
|
||||
logpath = __FINAL_PATH__/logs/seahub.log
|
||||
logpath = __INSTALL_DIR__/logs/seahub.log
|
||||
maxretry = 3
|
||||
|
|
16
conf/gunicorn.conf.py
Normal file
16
conf/gunicorn.conf.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import os
|
||||
|
||||
daemon = True
|
||||
workers = 5
|
||||
|
||||
# default localhost:8000
|
||||
bind = "127.0.0.1:__PORT_SEAHUB__"
|
||||
|
||||
# Pid
|
||||
pids_dir = '__INSTALL_DIR__/pids'
|
||||
pidfile = os.path.join(pids_dir, 'seahub.pid')
|
||||
|
||||
# for file upload, we need a longer timeout value (default is only 30s, too short)
|
||||
timeout = 1200
|
||||
|
||||
limit_request_line = 8190
|
|
@ -1,6 +1,6 @@
|
|||
location __PATH__ {
|
||||
proxy_redirect http:// https://;
|
||||
proxy_pass http://127.0.0.1:__SEAHUB_PORT__;
|
||||
proxy_pass http://127.0.0.1:__PORT_SEAHUB__;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
@ -17,7 +17,7 @@ location __PATH__ {
|
|||
}
|
||||
|
||||
location /seafhttp/ {
|
||||
proxy_pass http://127.0.0.1:__FILESERVER_PORT__/;
|
||||
proxy_pass http://127.0.0.1:__PORT_FILESERVER__/;
|
||||
client_max_body_size 0;
|
||||
proxy_connect_timeout 36000s;
|
||||
proxy_read_timeout 36000s;
|
||||
|
@ -26,11 +26,11 @@ location /seafhttp/ {
|
|||
|
||||
|
||||
location __PATH__/media/ {
|
||||
alias __FINALPATH__/seafile-server-latest/seahub/media/;
|
||||
alias __INSTALL_DIR__/seafile-server-latest/seahub/media/;
|
||||
}
|
||||
|
||||
location /seafdav {
|
||||
proxy_pass http://127.0.0.1:__WEBDAV_PORT__/seafdav;
|
||||
proxy_pass http://127.0.0.1:__PORT_WEBDAV__/seafdav;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[WEBDAV]
|
||||
enabled = true
|
||||
port = __WEBDAV_PORT__
|
||||
fastcgi = true
|
||||
port = __PORT_WEBDAV__
|
||||
share_name = /seafdav
|
||||
|
|
17
conf/seafile.conf
Normal file
17
conf/seafile.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
[fileserver]
|
||||
port = __PORT_FILESERVER__
|
||||
|
||||
# Set maximum upload file size to 200M.
|
||||
max_upload_size=1000
|
||||
|
||||
# Set maximum download directory size to 200M.
|
||||
max_download_dir_size=1000
|
||||
|
||||
[database]
|
||||
type = mysql
|
||||
host = 127.0.0.1
|
||||
port = 3306
|
||||
user = __DB_USER__
|
||||
password = __DB_PWD__
|
||||
db_name = __DB_NAME__
|
||||
connection_charset = utf8
|
44
conf/seahub_settings.py
Normal file
44
conf/seahub_settings.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
SECRET_KEY = "__SEAHUB_SECRET_KEY__"
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'seahubdb',
|
||||
'USER': '__DB_USER__',
|
||||
'PASSWORD': '__DB_PWD__',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
'OPTIONS': {
|
||||
'init_command': 'SET storage_engine=INNODB',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SERVICE_URL = "https://__DOMAIN____PATH__"
|
||||
FILE_SERVER_ROOT = "https://__DOMAIN__/seafhttp"
|
||||
SITE_ROOT = "__PATH2__"
|
||||
SERVE_STATIC = False
|
||||
MEDIA_URL = "__PATH2__media/"
|
||||
COMPRESS_URL = MEDIA_URL
|
||||
STATIC_URL = MEDIA_URL + 'assets/'
|
||||
EMAIL_USE_TLS = False
|
||||
EMAIL_HOST = "localhost"
|
||||
EMAIL_HOST_USER = "__APP__@__DOMAIN__"
|
||||
EMAIL_HOST_PASSWORD = ""
|
||||
EMAIL_PORT = "25"
|
||||
DEFAULT_FROM_EMAIL = "__APP__@__DOMAIN__"
|
||||
SERVER_EMAIL = "__APP__@__DOMAIN__"
|
||||
LOGIN_URL = '__PATH2__accounts/login/'
|
||||
ENABLE_WIKI = True
|
||||
ALLOWED_HOSTS = ['__DOMAIN__']
|
||||
ENABLE_REMOTE_USER_AUTHENTICATION = True
|
||||
REMOTE_USER_HEADER = 'HTTP_EMAIL'
|
||||
REMOTE_USER_CREATE_UNKNOWN_USER = False
|
||||
REMOTE_USER_PROTECTED_PATH = ['__PATH__', '__PATH2__accounts/login']
|
||||
TIME_ZONE = "__TIME_ZONE__"
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
},
|
||||
}
|
28
doc/ADMIN.md
Normal file
28
doc/ADMIN.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
### Multi-users support
|
||||
|
||||
This app support LDAP and the SSO authentification.
|
||||
|
||||
If you have Seafile installed before 7.x and you have more than one domain for users in Yunohost or Seafile app is installed on a different domain, you need to migrate your accounts.
|
||||
You can use the provided action at https://domain.tld/yunohost/admin/#/apps/seafile/actions. You can also use this following command to migrate all of your accounts:
|
||||
```
|
||||
yunohost app action run seafile migrate_user_email_to_mail_email
|
||||
```
|
||||
See [issue#44](https://github.com/YunoHost-Apps/seafile_ynh/issues/44)
|
||||
for more information.
|
||||
|
||||
### Backup
|
||||
|
||||
This app use now the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration is recommended to proceed like this:
|
||||
|
||||
- Stop seafile service with theses following command:
|
||||
|
||||
`systemctl stop seafile.service seahub.service`
|
||||
|
||||
- Launch the backup of seafile with this following command:
|
||||
|
||||
`yunohost backup create --app seafile`
|
||||
|
||||
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is stored in `/home/yunohost.app/seafile-data`.
|
||||
- Restart the seafile service with theses command:
|
||||
|
||||
`systemctl start seafile.service seahub.service`
|
|
@ -1,97 +0,0 @@
|
|||
### Multi-users support
|
||||
|
||||
This app support LDAP and the SSO authentification.
|
||||
|
||||
If you have Seafile installed before 7.x and you have more than one domain for users in Yunohost or Seafile app is installed on a different domain, you need to migrate your accounts.
|
||||
You can use the provided action at https://domain.tld/yunohost/admin/#/apps/seafile/actions. You can also use this following command to migrate all of your accounts:
|
||||
```
|
||||
yunohost app action run seafile migrate_user_email_to_mail_email
|
||||
```
|
||||
See [issue#44](https://github.com/YunoHost-Apps/seafile_ynh/issues/44)
|
||||
for more information.
|
||||
|
||||
### Supported architectures
|
||||
|
||||
Since seafile 6.3 the i386 architecture is no more supported.
|
||||
|
||||
Seafile don't distribute binary for generic armhf architectures but rpi binary generally work on all arm board.
|
||||
|
||||
<!--Limitations
|
||||
------------
|
||||
|
||||
* Any known limitations.-->
|
||||
|
||||
Additional informations
|
||||
-----------------------
|
||||
|
||||
### Links
|
||||
|
||||
* Report a bug: https://github.com/YunoHost-Apps/seafile_ynh/issues
|
||||
* App website: https://www.seafile.com
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
### Install
|
||||
|
||||
From command line:
|
||||
|
||||
`yunohost app install seafile`
|
||||
|
||||
### Upgrade
|
||||
|
||||
By default a backup is made before the upgrade. To avoid this you have theses following possibilites:
|
||||
- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade synapse`.
|
||||
- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command:
|
||||
|
||||
`yunohost app setting synapse disable_backup_before_upgrade -v 1`
|
||||
|
||||
After this settings will be applied for **all** next upgrade.
|
||||
|
||||
From command line:
|
||||
|
||||
`yunohost app upgrade seafile`
|
||||
|
||||
### Backup
|
||||
|
||||
This app use now the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration is recommended to proceed like this:
|
||||
|
||||
- Stop seafile service with theses following command:
|
||||
|
||||
`systemctl stop seafile.service seahub.service`
|
||||
|
||||
- Launch the backup of seafile with this following command:
|
||||
|
||||
`yunohost backup create --app seafile`
|
||||
|
||||
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is stored in `/home/yunohost.app/seafile-data`.
|
||||
- Restart the seafile service with theses command:
|
||||
|
||||
`systemctl start seafile.service seahub.service`
|
||||
|
||||
### Remove
|
||||
|
||||
Due of the backup core only feature the data directory in `/home/yunohost.app/seafile-data` **is not removed**. It need to be removed manually to purge app user data.
|
||||
|
||||
### Change URL
|
||||
|
||||
Since now it's possible to change domain or the url of seafile.
|
||||
|
||||
To do this run : `yunohost app change-url seafile -d new_domain.tld -p PATH new_path`
|
||||
|
||||
Developers infos
|
||||
----------------
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/seafile_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade seafile -u https://github.com/YunoHost-Apps/seafile_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
- Find a way to fix the issue https://github.com/YunoHost-Apps/seafile_ynh/issues/5
|
|
@ -1,79 +0,0 @@
|
|||
{
|
||||
"name": "Seafile",
|
||||
"id": "seafile",
|
||||
"packaging_format": 1,
|
||||
"license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0",
|
||||
"url": "https://www.seafile.com",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0",
|
||||
"website": "https://www.seafile.com",
|
||||
"demo": "https://demo.seafile.com",
|
||||
"admindoc": "https://manual.seafile.com",
|
||||
"code": "https://github.com/haiwen/seafile-server"
|
||||
},
|
||||
"version": "9.0.2~ynh2",
|
||||
"description": {
|
||||
"en": "Open Source Cloud Storage",
|
||||
"fr": "Stockage Cloud Open Source"
|
||||
},
|
||||
"maintainer": {
|
||||
"name": "Josué Tille",
|
||||
"email": "josue@tille.ch"
|
||||
},
|
||||
"previous_maintainers": {
|
||||
"name": "mbugeia",
|
||||
"email": "maxime@max.privy.place"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"mysql"
|
||||
],
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3"
|
||||
},
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"default": "/seafile"
|
||||
},
|
||||
{
|
||||
"name": "server_name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose a name (3 - 15 letters or digits)",
|
||||
"fr": "Choisissez un nom (3 - 15 letters or digits)"
|
||||
},
|
||||
"example": "Seafile",
|
||||
"default": "Seafile"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "admin_password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Enter a password for the administrator",
|
||||
"fr": "Entrez un mot de passe pour l'administrateur"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "If it's not public, everybody which want to access to any page of seafile need to be authenticated on the SSO. On the public mode anybody can access to the authentication page. The shared link will be olso accessible by anybody who has this link.",
|
||||
"fr": "Si n'est pas publique, n'importe qui veux accéder à n'importe quelle page de seafile doit être authentifié dans le SSO. Dans le mode publique n'importe qui peut accéder à la page d'authentification de seafile. Les liens partagé seront aussi accessible par n'import qui qui à ce liens."
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
122
manifest.toml
Normal file
122
manifest.toml
Normal file
|
@ -0,0 +1,122 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "seafile"
|
||||
name = "Seafile"
|
||||
description.en = "Open Source Cloud Storage"
|
||||
description.fr = "Stockage Cloud Open Source"
|
||||
|
||||
version = "9.0.9~ynh1"
|
||||
|
||||
maintainers = ["Josué Tille"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0,Apache-2.0,MIT,GPL-2.0"
|
||||
website = "https://www.seafile.com"
|
||||
demo = "https://demo.seafile.com"
|
||||
admindoc = "https://manual.seafile.com"
|
||||
code = "https://github.com/haiwen/seafile-server"
|
||||
cpe = "cpe:2.3:a:seafile:seafile"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2.3"
|
||||
architectures = ["amd64", "arm64", "armhf"]
|
||||
multi_instance = false
|
||||
ldap = true
|
||||
sso = true
|
||||
disk = "1G"
|
||||
ram.build = "1G"
|
||||
ram.runtime = "500M"
|
||||
|
||||
[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
|
||||
type = "path"
|
||||
default = "/seafile"
|
||||
|
||||
[install.server_name]
|
||||
ask.en = "Choose a name (3 - 15 letters or digits)"
|
||||
ask.fr = "Choisissez un nom (3 - 15 letters or digits)"
|
||||
type = "string"
|
||||
example = "Seafile"
|
||||
default = "Seafile"
|
||||
|
||||
[install.admin]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "user"
|
||||
|
||||
[install.admin_password]
|
||||
ask.en = "Enter a password for the administrator"
|
||||
ask.fr = "Entrez un mot de passe pour l'administrateur"
|
||||
type = "password"
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "If it's not public, everybody which want to access to any page of seafile need to be authenticated on the SSO. On the public mode anybody can access to the authentication page. The shared link will be olso accessible by anybody who has this link."
|
||||
help.fr = "Si n'est pas publique, n'importe qui veux accéder à n'importe quelle page de seafile doit être authentifié dans le SSO. Dans le mode publique n'importe qui peut accéder à la page d'authentification de seafile. Les liens partagé seront aussi accessible par n'import qui qui à ce liens."
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[resources]
|
||||
[resources.system_user]
|
||||
allow_email = true
|
||||
home = "/opt/yunohost/__APP__"
|
||||
|
||||
[resources.install_dir]
|
||||
dir = "/opt/yunohost/__APP__"
|
||||
owner = "__APP__:rwX"
|
||||
group = "__APP__:rX"
|
||||
subdirs = ["installed", "logs"]
|
||||
|
||||
[resources.data_dir]
|
||||
dir = "/home/yunohost.app/seafile-data"
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
file_server.url = "__DOMAIN__/seafhttp"
|
||||
file_server.label = "File server"
|
||||
file_server.allowed = "visitors"
|
||||
file_server.auth_header = false
|
||||
file_server.show_tile = false
|
||||
file_server.protected = true
|
||||
|
||||
webdav.url = "__DOMAIN__/seafdav"
|
||||
webdav.label = "Webdav"
|
||||
webdav.allowed = "visitors"
|
||||
webdav.auth_header = true
|
||||
webdav.protected = true
|
||||
webdav.show_tile = false
|
||||
|
||||
media.url = "/media"
|
||||
media.label = "Media"
|
||||
media.allowed = "visitors"
|
||||
media.auth_header = true
|
||||
media.protected = true
|
||||
media.show_tile = false
|
||||
|
||||
[resources.ports]
|
||||
seahub.default = 8000
|
||||
fileserver.default = 8082
|
||||
webdav.default = 8080
|
||||
|
||||
[resources.sources.main]
|
||||
amd64.url = "https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_9.0.9_x86-64.tar.gz"
|
||||
amd64.sha256 = "db76bb33572ad0a6860470e907bed4ed780aa17d9e022226d99448a7f9e4ba74"
|
||||
arm64.url = "https://github.com/haiwen/seafile-rpi/releases/download/v9.0.9/seafile-server-9.0.9-bullseye-arm64v8l.tar.gz"
|
||||
arm64.sha256 = "c58f5d6b741dec240be9d75d6e617102b7adbfeba98cbd866732822bf9ca10b7"
|
||||
armhf.url = "https://github.com/haiwen/seafile-rpi/releases/download/v9.0.9/seafile-server-9.0.9-bullseye-arm32v7l.tar.gz"
|
||||
armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6"
|
||||
|
||||
[resources.apt]
|
||||
packages = ["expect", "ffmpeg", "pkgconf",
|
||||
"python3", "python3-venv", "python3-setuptools", "python3-pip", "python3-dev",
|
||||
"python3-requests", "python3-scipy", "python3-matplotlib",
|
||||
"mariadb-server", "libmariadb-dev-compat", "libmariadb-dev",
|
||||
"memcached", "libmemcached-dev",
|
||||
"libjpeg62-turbo-dev", "zlib1g-dev", "libffi-dev"]
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
|
@ -2,81 +2,85 @@
|
|||
# SET ALL CONSTANTS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
time_zone=$(cat /etc/timezone)
|
||||
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
|
||||
|
||||
#=================================================
|
||||
# DEFINE ALL COMMON FONCTIONS
|
||||
#=================================================
|
||||
|
||||
install_source() {
|
||||
mkdir "$final_path/seafile-server-$seafile_version"
|
||||
if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ]
|
||||
then
|
||||
ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture"
|
||||
fi
|
||||
ynh_setup_source "$final_path/seafile-server-$seafile_version" "$YNH_ARCH"
|
||||
|
||||
# Drop some conflicting package cf: https://forum.seafile.com/t/seahub-fails-to-start-nameerror-name-mysql-is-not-defined/14566/3
|
||||
ynh_secure_remove --file=$final_path/seafile-server-$seafile_version/seahub/thirdpart/MySQLdb
|
||||
ynh_secure_remove --file=$final_path/seafile-server-$seafile_version/seahub/thirdpart/cffi
|
||||
ynh_secure_remove --file=$final_path/seafile-server-$seafile_version/seahub/thirdpart/PIL
|
||||
}
|
||||
|
||||
install_source_7_0() {
|
||||
if ! [ -e $final_path/seafile-server-7.0.5 ]; then
|
||||
mkdir "$final_path/seafile-server-7.0.5"
|
||||
if [ $YNH_ARCH == "i386" ] || [ $YNH_ARCH == "armel" ]
|
||||
then
|
||||
ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture"
|
||||
fi
|
||||
ynh_setup_source "$final_path/seafile-server-7.0.5" "$YNH_ARCH"_7_0
|
||||
fi
|
||||
}
|
||||
|
||||
install_dependance() {
|
||||
ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev libmariadb-dev-compat libmariadb-dev \
|
||||
expect ffmpeg \
|
||||
memcached libmemcached-dev \
|
||||
python3-scipy python3-matplotlib \
|
||||
libjpeg62-turbo-dev zlib1g-dev libffi-dev # For building pillow
|
||||
ynh_add_swap --size=2000
|
||||
# We need to do that because we can have some issue about the permission access to the pip cache without this
|
||||
chown -R $seafile_user:$seafile_user $final_path
|
||||
|
||||
# Clean venv is it was on python3 with old version in case major upgrade of debian
|
||||
if [ ! -e $install_dir/venv/bin/python3 ] || [ ! -e $install_dir/venv/lib/python$python_version ]; then
|
||||
ynh_secure_remove --file=$install_dir/venv/bin
|
||||
ynh_secure_remove --file=$install_dir/venv/lib
|
||||
ynh_secure_remove --file=$install_dir/venv/lib64
|
||||
ynh_secure_remove --file=$install_dir/venv/include
|
||||
ynh_secure_remove --file=$install_dir/venv/share
|
||||
ynh_secure_remove --file=$install_dir/venv/pyvenv.cfg
|
||||
fi
|
||||
|
||||
# Create venv if it don't exist
|
||||
test -e $install_dir/venv/bin/python3 || python3 -m venv $install_dir/venv
|
||||
|
||||
u_arg='u'
|
||||
set +$u_arg;
|
||||
source $install_dir/venv/bin/activate
|
||||
set -$u_arg;
|
||||
|
||||
# Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5
|
||||
sudo -u $seafile_user pip3 install --user --no-warn-script-location --upgrade future mysqlclient PyMySQL 'Pillow<10.0.0' pylibmc captcha Jinja2 SQLAlchemy psd-tools django-pylibmc django-simple-captcha python3-ldap pycryptodome==3.12.0 cffi==1.14.0
|
||||
# TODO add dependance when upgrade to seafile 8: django==2.2.*
|
||||
if [ $(lsb_release --codename --short) == "bookworm" ]; then
|
||||
# Fix cffi installtion issue cf: https://github.com/haiwen/seahub/issues/5166
|
||||
pip3 install --upgrade 'cffi==1.15.1'
|
||||
sed -e "s|1.14.0|1.15.1|" -i $install_dir/seafile-server-$seafile_version/seahub/thirdpart/cffi/__init__.py
|
||||
else
|
||||
pip3 install --upgrade cffi==1.14.0
|
||||
fi
|
||||
|
||||
pip3 install --upgrade future mysqlclient PyMySQL 'Pillow<10.0.0' pylibmc captcha Jinja2 'SQLAlchemy<2' psd-tools django-pylibmc django-simple-captcha python3-ldap pycryptodome==3.12.0 lxml
|
||||
|
||||
set +$u_arg;
|
||||
deactivate
|
||||
set -$u_arg;
|
||||
ynh_del_swap
|
||||
|
||||
# Create symbolic link to venv package on seahub
|
||||
ls $install_dir/venv/lib/python$python_version/site-packages | while read f; do
|
||||
if [ ! -e "$install_dir/seafile-server-$seafile_version/seahub/thirdpart/$f" ]; then
|
||||
ln -s ../../../venv/lib/python$python_version/site-packages/$f $install_dir/seafile-server-$seafile_version/seahub/thirdpart/$f
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mv_expect_scripts() {
|
||||
expect_scripts_dir=$(mktemp -d)
|
||||
cp expect_scripts/* $expect_scripts_dir
|
||||
chmod u=rwx,o= -R $expect_scripts_dir
|
||||
chown $seafile_user -R $expect_scripts_dir
|
||||
chown $YNH_APP_ID -R $expect_scripts_dir
|
||||
}
|
||||
|
||||
set_permission() {
|
||||
chown -R $seafile_user:$seafile_user $final_path
|
||||
chmod -R g-wx,o= $final_path
|
||||
setfacl -m user:www-data:rX $final_path
|
||||
setfacl -m user:www-data:rX $final_path/seafile-server-$seafile_version
|
||||
chown -R $YNH_APP_ID:$YNH_APP_ID $install_dir
|
||||
chmod -R u+rwX,g-wx,o= $install_dir
|
||||
setfacl -m user:www-data:rX $install_dir
|
||||
setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version
|
||||
# At install time theses directory are not available
|
||||
test -e $final_path/seafile-server-latest/seahub && setfacl -m user:www-data:rX $final_path/seafile-server-latest/seahub
|
||||
test -e $final_path/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $final_path/seafile-server-latest/seahub/media
|
||||
test -e $final_path/seahub-data && setfacl -R -m user:www-data:rX $final_path/seahub-data
|
||||
test -e $install_dir/seafile-server-latest/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-latest/seahub
|
||||
test -e $install_dir/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-latest/seahub/media
|
||||
test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $install_dir/seahub-data
|
||||
|
||||
# check that this directory exist because in some really old install the data could still be in the main seafile directory
|
||||
# We also check at the install time when data directory is not already initialised
|
||||
if [ -e /home/yunohost.app/seafile-data ]; then
|
||||
chown -R $seafile_user:$seafile_user /home/yunohost.app/seafile-data
|
||||
chown -R $YNH_APP_ID /home/yunohost.app/seafile-data
|
||||
chmod -R o= /home/yunohost.app/seafile-data
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_clean_setup () {
|
||||
pkill -f seafile-controller
|
||||
pkill -f seaf-server
|
||||
pkill -f ccnet-server
|
||||
pkill -f seahub
|
||||
clean_url_in_db_config() {
|
||||
sql_request='DELETE FROM `constance_config` WHERE `constance_key`= "SERVICE_URL"'
|
||||
ynh_mysql_execute_as_root --sql "$sql_request" --database seahubdb
|
||||
sql_request='DELETE FROM `constance_config` WHERE `constance_key`= "FILE_SERVER_ROOT"'
|
||||
ynh_mysql_execute_as_root --sql "$sql_request" --database seahubdb
|
||||
}
|
||||
|
|
|
@ -93,21 +93,21 @@ migrate_email_in_database() {
|
|||
|
||||
# seafile DB
|
||||
# Note that when we do a migration from seafile v6 some time don't exist. So yes it's probably a bug on seafile side. But anyway just ignore this problem...
|
||||
mysql_relpace_db seafiledb FolderUserPerm user || true
|
||||
mysql_relpace_db seafiledb OrgGroupRepo owner || true
|
||||
mysql_relpace_db seafiledb OrgRepo user || true
|
||||
mysql_relpace_db seafiledb OrgSharedRepo from_email || true
|
||||
mysql_relpace_db seafiledb OrgSharedRepo to_email || true
|
||||
mysql_relpace_db seafiledb OrgUserQuota user
|
||||
mysql_relpace_db seafiledb RepoGroup user_name
|
||||
mysql_relpace_db seafiledb RepoInfo last_modifier
|
||||
mysql_relpace_db seafiledb RepoOwner owner_id
|
||||
mysql_relpace_db seafiledb RepoTrash owner_id
|
||||
mysql_relpace_db seafiledb RepoUserToken email
|
||||
mysql_relpace_db seafiledb SharedRepo from_email
|
||||
mysql_relpace_db seafiledb SharedRepo to_email
|
||||
mysql_relpace_db seafiledb UserQuota user
|
||||
mysql_relpace_db seafiledb UserShareQuota user
|
||||
mysql_relpace_db $db_name FolderUserPerm user || true
|
||||
mysql_relpace_db $db_name OrgGroupRepo owner || true
|
||||
mysql_relpace_db $db_name OrgRepo user || true
|
||||
mysql_relpace_db $db_name OrgSharedRepo from_email || true
|
||||
mysql_relpace_db $db_name OrgSharedRepo to_email || true
|
||||
mysql_relpace_db $db_name OrgUserQuota user
|
||||
mysql_relpace_db $db_name RepoGroup user_name
|
||||
mysql_relpace_db $db_name RepoInfo last_modifier
|
||||
mysql_relpace_db $db_name RepoOwner owner_id
|
||||
mysql_relpace_db $db_name RepoTrash owner_id
|
||||
mysql_relpace_db $db_name RepoUserToken email
|
||||
mysql_relpace_db $db_name SharedRepo from_email
|
||||
mysql_relpace_db $db_name SharedRepo to_email
|
||||
mysql_relpace_db $db_name UserQuota user
|
||||
mysql_relpace_db $db_name UserShareQuota user
|
||||
|
||||
# seahub DB
|
||||
mysql_relpace_db seahubdb api2_token user
|
||||
|
@ -168,33 +168,10 @@ migrate_user() {
|
|||
start_seafile
|
||||
}
|
||||
|
||||
migrate_all_user() {
|
||||
stop_seafile
|
||||
get_email_list_in_seafile
|
||||
|
||||
for user in $user_list; do
|
||||
# Try to get the main email of the user in yunohost which has is the old email
|
||||
user_main_email=$(yunohost tools shell -c "
|
||||
from yunohost.user import user_info
|
||||
info = user_info('$user'.split('@')[0])
|
||||
print(info['mail'])
|
||||
exit()
|
||||
")
|
||||
if [ "$user" == "$user_main_email" ]; then
|
||||
ynh_print_info --message "Nothing to do for user $user."
|
||||
fi
|
||||
|
||||
migrate_email_in_database $user $user_main_email
|
||||
done
|
||||
|
||||
start_seafile
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
||||
case $YNH_ACTION in
|
||||
migrate_user_email_to_mail_email) migrate_all_user;;
|
||||
change_user_email) migrate_user;;
|
||||
esac
|
||||
|
|
|
@ -11,17 +11,8 @@ source ../settings/scripts/_common.sh
|
|||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
# retrieve useful param
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||
seafile_version=$(ynh_app_upstream_version)
|
||||
seafile_user=$app
|
||||
|
||||
if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: failed (Result: signal)" ]]; then
|
||||
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'"
|
||||
|
@ -33,7 +24,7 @@ fi
|
|||
|
||||
# # Backup app files
|
||||
ynh_print_info --message="Backing up code..."
|
||||
ynh_backup --src_path $final_path
|
||||
ynh_backup --src_path $install_dir
|
||||
ynh_print_info --message="Backing up user data..."
|
||||
ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1
|
||||
ynh_print_info --message="Backing up configuration..."
|
||||
|
@ -45,8 +36,8 @@ ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf
|
|||
|
||||
# Backup mysql
|
||||
ynh_print_info --message="Backing up database"
|
||||
ynh_mysql_dump_db --database $db_name > ${YNH_CWD}/seafiledb.dmp
|
||||
ynh_mysql_dump_db --database ccnetdb > ${YNH_CWD}/ccnetdb.dmp
|
||||
ynh_mysql_dump_db --database seafiledb > ${YNH_CWD}/seafiledb.dmp
|
||||
ynh_mysql_dump_db --database seahubdb > ${YNH_CWD}/seahubdb.dmp
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -11,55 +11,56 @@ source ./_common.sh
|
|||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Retrive arguments
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
domain=$YNH_APP_NEW_DOMAIN
|
||||
old_path=$(ynh_normalize_url_path --path_url $YNH_APP_OLD_PATH)
|
||||
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_NEW_PATH)
|
||||
seahub_port=$(ynh_app_setting_get --app $app --key seahub_port)
|
||||
fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port)
|
||||
webdav_port=$(ynh_app_setting_get --app $app --key webdav_port)
|
||||
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||
seafile_user=$app
|
||||
path=$new_path
|
||||
domain=$new_domain
|
||||
|
||||
# Create special path with / at the end
|
||||
if [[ $old_path == '/' ]]
|
||||
if [[ $path == '/' ]]
|
||||
then
|
||||
old_path2=$old_path
|
||||
path2=$path
|
||||
else
|
||||
old_path2=$old_path'/'
|
||||
path2=$path"/"
|
||||
fi
|
||||
|
||||
if [[ $path_url == '/' ]]
|
||||
then
|
||||
path_url2=$path_url
|
||||
else
|
||||
path_url2=$path_url'/'
|
||||
fi
|
||||
# Patch helper
|
||||
|
||||
ynh_change_url_nginx_config() {
|
||||
local old_nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
local new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
ynh_delete_file_checksum --file="$old_nginx_conf_path"
|
||||
mv "$old_nginx_conf_path" "$new_nginx_conf_path"
|
||||
ynh_store_file_checksum --file="$new_nginx_conf_path"
|
||||
fi
|
||||
|
||||
# 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="$new_nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
path="$new_path"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Updating nginx configuration..."
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
# Update nginx config
|
||||
if [ "$old_domain" != "$domain" ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum --file "/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
||||
|
||||
mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
fi
|
||||
ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Stoping services..."
|
||||
|
||||
|
@ -75,16 +76,17 @@ pkill -f seahub || true
|
|||
ynh_script_progression --message="Updating seafile configuration..."
|
||||
|
||||
# Update Seafile Config
|
||||
ynh_replace_string --match_string "SERVICE_URL = https://$old_domain$old_path" --replace_string "SERVICE_URL = https://$domain$path_url" --target_file $final_path/conf/ccnet.conf
|
||||
ynh_add_config --template=seahub_settings.py --destination=$install_dir/conf/seahub_settings.py
|
||||
ynh_add_config --template=ccnet.conf --destination=$install_dir/conf/ccnet.conf
|
||||
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py
|
||||
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf
|
||||
|
||||
ynh_replace_string --match_string 'FILE_SERVER_ROOT = "https://'"$old_domain"'/seafhttp"' --replace_string 'FILE_SERVER_ROOT = "https://'"$domain"'/seafhttp"' --target_file $final_path/conf/seahub_settings.py
|
||||
ynh_replace_string --match_string 'SITE_ROOT = "'"$old_path2"'"' --replace_string 'SITE_ROOT = "'"$path_url2"'"' --target_file $final_path/conf/seahub_settings.py
|
||||
ynh_replace_string --match_string 'MEDIA_URL = "'"$old_path2"'media/"' --replace_string 'MEDIA_URL = "'"$path_url2"'media/"' --target_file $final_path/conf/seahub_settings.py
|
||||
ynh_replace_string --match_string "LOGIN_URL = '${old_path2}accounts/login/'" --replace_string "LOGIN_URL = '${path_url2}accounts/login/'" --target_file $final_path/conf/seahub_settings.py
|
||||
ynh_replace_string --match_string ' = "seafile@'"$old_domain"'"' --replace_string ' = "seafile@'"$domain"'"' --target_file $final_path/conf/seahub_settings.py
|
||||
sed --in-place "s@ALLOWED_HOSTS = \['${old_domain}'\]@ALLOWED_HOSTS = \['${domain}'\]@g" $final_path/conf/seahub_settings.py
|
||||
ynh_replace_string --match_string "REMOTE_USER_DOMAIN = '$old_domain'" --replace_string "REMOTE_USER_DOMAIN = '$domain'" --target_file $final_path/conf/seahub_settings.py
|
||||
sed --in-place "s@REMOTE_USER_PROTECTED_PATH = \['$old_path', '$old_path/accounts/login'\]@REMOTE_USER_PROTECTED_PATH = \['$path_url', '$path_url/accounts/login'\]@g" $final_path/conf/seahub_settings.py
|
||||
# Update permissions
|
||||
ynh_permission_url --permission=file_server --url=$domain/seafhttp
|
||||
ynh_permission_url --permission=webdav --url=$domain/seafdav
|
||||
|
||||
# Clean url in config in DB
|
||||
clean_url_in_db_config
|
||||
|
||||
# Avoid the current effect
|
||||
sleep 2
|
||||
|
|
|
@ -5,7 +5,8 @@ set seafile_dir [lindex $argv 0]
|
|||
set server_name [lindex $argv 1]
|
||||
set domain [lindex $argv 2]
|
||||
set fileserver_port [lindex $argv 3]
|
||||
set db_pwd [lindex $argv 4]
|
||||
set db_name [lindex $argv 4]
|
||||
set db_pwd [lindex $argv 5]
|
||||
|
||||
spawn $seafile_dir/setup-seafile-mysql.sh
|
||||
|
||||
|
@ -40,7 +41,7 @@ expect "Enter the existing database name for ccnet:"
|
|||
send "ccnetdb\r";
|
||||
|
||||
expect "Enter the existing database name for seafile:"
|
||||
send "seafiledb\r";
|
||||
send "$db_name\r";
|
||||
|
||||
expect "Enter the existing database name for seahub:"
|
||||
send "seahubdb\r";
|
||||
|
|
205
scripts/install
205
scripts/install
|
@ -11,175 +11,90 @@ source ./_common.sh
|
|||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
server_name="$YNH_APP_ARG_SERVER_NAME"
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
seafile_data=/home/yunohost.app/seafile-data
|
||||
final_path=/opt/yunohost/$app
|
||||
seafile_user=$app
|
||||
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
||||
seafile_version=$(ynh_app_upstream_version)
|
||||
|
||||
# Create special path with / at the end
|
||||
if [[ $path_url == '/' ]]
|
||||
if [[ $path == '/' ]]
|
||||
then
|
||||
path_url2=$path_url
|
||||
path2=$path
|
||||
else
|
||||
path_url2=$path_url"/"
|
||||
path2=$path"/"
|
||||
fi
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app $app --domain $domain --path_url $path_url
|
||||
|
||||
# Check Final Path availability
|
||||
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
|
||||
if [ -e "$seafile_data" ]; then
|
||||
old_data_dir_path="$seafile_data$(date '+%Y%m%d.%H%M%S')"
|
||||
ynh_print_warn "A data directory already exist. Data was renamed to $old_data_dir_path"
|
||||
mv "$seafile_data" "$old_data_dir_path"
|
||||
fi
|
||||
|
||||
# Find available ports
|
||||
ynh_script_progression --message="Finding available ports..."
|
||||
seahub_port=$(ynh_find_port --port 8000)
|
||||
fileserver_port=$(ynh_find_port --port 8082)
|
||||
webdav_port=$(ynh_find_port --port 8080)
|
||||
|
||||
if [ $fileserver_port -eq $webdav_port ]; then
|
||||
webdav_port=$(ynh_find_port --port $((fileserver_port + 1)))
|
||||
fi
|
||||
|
||||
# store config in yunohost
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
ynh_app_setting_set --app $app --key server_name --value "$server_name"
|
||||
ynh_app_setting_set --app $app --key final_path --value $final_path
|
||||
ynh_app_setting_set --app $app --key seafile_user --value $seafile_user
|
||||
ynh_app_setting_set --app $app --key admin --value $admin
|
||||
ynh_app_setting_set --app $app --key seahub_port --value $seahub_port
|
||||
ynh_app_setting_set --app $app --key fileserver_port --value $fileserver_port
|
||||
ynh_app_setting_set --app $app --key webdav_port --value $webdav_port
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Creating base directory..."
|
||||
mkdir -p $final_path
|
||||
mkdir -p $final_path/installed
|
||||
mkdir -p $final_path/logs
|
||||
mkdir -p $seafile_data
|
||||
ln -s $seafile_data $final_path/seafile-data
|
||||
|
||||
# Create User
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
ynh_system_user_create --username $seafile_user --home_dir $final_path
|
||||
|
||||
# Check dependencies
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=7
|
||||
install_dependance
|
||||
ln -s $data_dir $install_dir/seafile-data
|
||||
|
||||
# Download new version from sources
|
||||
ynh_script_progression --message="Installing sources files..." --weight=7
|
||||
install_source
|
||||
ynh_setup_source --dest_dir=$install_dir/seafile-server-$seafile_version
|
||||
|
||||
ynh_script_progression --message="Installing python dependancies..."
|
||||
install_dependance
|
||||
|
||||
# init databases
|
||||
ynh_script_progression --message="Configuring MySQL database..."
|
||||
db_user=seafile
|
||||
ynh_mysql_setup_db --db_user $db_user --db_name ccnetdb
|
||||
ynh_mysql_setup_db --db_user $db_user --db_name seafiledb --db_pwd "$db_pwd"
|
||||
ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
|
||||
db_helper=ynh_"mysql"_setup_db
|
||||
$db_helper --db_user $db_user --db_name ccnetdb --db_pwd "$db_pwd"
|
||||
$db_helper --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
|
||||
|
||||
ynh_script_progression --message="Configuring application..." --weight=3
|
||||
|
||||
# Run install script
|
||||
mv_expect_scripts
|
||||
chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh
|
||||
chmod +x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh
|
||||
set_permission
|
||||
sudo -u $seafile_user $expect_scripts_dir/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$fileserver_port" "$db_pwd"
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/install.exp "$install_dir/seafile-server-$seafile_version" "$server_name" "$domain" "$port_fileserver" "$db_name" "$db_pwd"
|
||||
|
||||
sleep 3
|
||||
|
||||
# Update seafile config
|
||||
ynh_replace_string --match_string http:// --replace_string https:// --target_file $final_path/conf/ccnet.conf
|
||||
ynh_replace_string --match_string :8000 --replace_string $path_url --target_file $final_path/conf/ccnet.conf
|
||||
echo 'FILE_SERVER_ROOT = "https://'$domain'/seafhttp"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'SITE_ROOT = "'$path_url2'"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'SERVE_STATIC = False' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'MEDIA_URL = "'$path_url2'media/"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'COMPRESS_URL = MEDIA_URL' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "STATIC_URL = MEDIA_URL + 'assets/'" | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "LOGIN_URL = '"$path_url2"accounts/login/'" | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "ALLOWED_HOSTS = ['"$domain"']" | tee -a $final_path/conf/seahub_settings.py
|
||||
# Retrive values from auto generated config file
|
||||
seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2)
|
||||
ynh_app_setting_set --app $app --key seahub_secret_key --value $seahub_secret_key
|
||||
|
||||
# Email configuration
|
||||
echo 'EMAIL_USE_TLS = False' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'EMAIL_HOST = "localhost"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'EMAIL_HOST_USER = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'EMAIL_PORT = "25"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'DEFAULT_FROM_EMAIL = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'SERVER_EMAIL = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'EMAIL_HOST_PASSWORD = ""' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "TIME_ZONE = \"$(cat /etc/timezone)\"" | tee -a $final_path/conf/seahub_settings.py
|
||||
|
||||
# SSO authentication
|
||||
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "REMOTE_USER_HEADER = 'HTTP_EMAIL'" | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'REMOTE_USER_CREATE_UNKNOWN_USER = False' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "REMOTE_USER_PROTECTED_PATH = ['$path_url', '$path_url/accounts/login']" | tee -a $final_path/conf/seahub_settings.py
|
||||
|
||||
# LDAP configuration
|
||||
echo '[LDAP]' | tee -a $final_path/conf/ccnet.conf
|
||||
echo 'HOST = ldap://localhost:389' | tee -a $final_path/conf/ccnet.conf
|
||||
echo 'BASE = ou=users,dc=yunohost,dc=org' | tee -a $final_path/conf/ccnet.conf
|
||||
echo 'LOGIN_ATTR = mail' | tee -a $final_path/conf/ccnet.conf
|
||||
echo "FILTER = permission=cn=$app.main,ou=permission,dc=yunohost,dc=org" | tee -a $final_path/conf/ccnet.conf
|
||||
|
||||
# Enable manually wiki
|
||||
echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py
|
||||
|
||||
# Enable memcached
|
||||
cat >> $final_path/conf/seahub_settings.py <<EOF
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
},
|
||||
}
|
||||
EOF
|
||||
# Update seafile config files
|
||||
ynh_add_config --template=seahub_settings.py --destination=$install_dir/conf/seahub_settings.py
|
||||
ynh_add_config --template=seafile.conf --destination=$install_dir/conf/seafile.conf
|
||||
ynh_add_config --template=ccnet.conf --destination=$install_dir/conf/ccnet.conf
|
||||
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py
|
||||
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf
|
||||
|
||||
# Configure admin info
|
||||
# It will be used the first start
|
||||
admin_email=$(ynh_user_get_info --username $admin --key 'mail')
|
||||
cp ../conf/create_admin.json $final_path/conf/admin.txt
|
||||
ynh_replace_string --match_string __ADMIN__ --replace_string $admin_email --target_file $final_path/conf/admin.txt
|
||||
ynh_replace_special_string --match_string __PASSWORD__ --replace_string $admin_password --target_file $final_path/conf/admin.txt
|
||||
cp ../conf/create_admin.json $install_dir/conf/admin.txt
|
||||
ynh_replace_string --match_string __ADMIN__ --replace_string $admin_email --target_file $install_dir/conf/admin.txt
|
||||
ynh_replace_special_string --match_string __PASSWORD__ --replace_string $admin_password --target_file $install_dir/conf/admin.txt
|
||||
|
||||
# Fix local warning
|
||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $final_path/seafile-server-$seafile_version/seahub.sh
|
||||
|
||||
# Update gunicorn config
|
||||
sed --in-place -r "s@bind = \"127\.0\.0\.1:[[:digit:]]+\"@bind = \"127.0.0.1:$seahub_port\"@g" $final_path/conf/gunicorn.conf.py
|
||||
|
||||
# Add webdav
|
||||
cp ../conf/seafdav.conf $final_path/conf/seafdav.conf
|
||||
ynh_replace_string --match_string __WEBDAV_PORT__ --replace_string $webdav_port --target_file $final_path/conf/seafdav.conf
|
||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $install_dir/seafile-server-$seafile_version/seahub.sh
|
||||
|
||||
# Add Seafile Server to startup
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
ynh_add_systemd_config --service seafile --template seafile.service
|
||||
ynh_add_systemd_config --service seahub --template seahub.service
|
||||
|
||||
# register yunohost service
|
||||
yunohost service add seafile
|
||||
yunohost service add seahub
|
||||
|
||||
# Config nginx
|
||||
ynh_script_progression --message="Configuring nginx..." --weight=1
|
||||
ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
||||
ynh_script_progression --message="Configuring nginx..."
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Add logrotate
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
ynh_use_logrotate --logfile $install_dir/logs
|
||||
ln -s $install_dir/logs /var/log/seafile
|
||||
|
||||
# Add fail2ban
|
||||
ynh_script_progression --message="Configuring fail2ban..."
|
||||
touch $install_dir/logs/seahub.log
|
||||
ynh_add_fail2ban_config --use_template
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -189,41 +104,13 @@ ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
|||
ynh_script_progression --message="Protecting directory..."
|
||||
set_permission
|
||||
|
||||
# Add sso config to unprotect domain.tld/seafhttp + domain.tld/seafdav
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
ynh_permission_create --permission=file_server --url=$domain/seafhttp --auth_header=false \
|
||||
--label="File server" --protected=true --allowed=visitors
|
||||
ynh_permission_create --permission=webdav --url=$domain/seafdav --auth_header=true \
|
||||
--label="Webdav" --protected=true --allowed=visitors
|
||||
# unprotect media
|
||||
ynh_permission_create --permission=media --url=/media --auth_header=true \
|
||||
--label="Media" --protected=true --allowed=visitors
|
||||
|
||||
if [ "$is_public" == '1' ];
|
||||
then
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
# Add logrotate
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
ynh_use_logrotate --logfile $final_path/logs
|
||||
ln -s $final_path/logs /var/log/seafile
|
||||
|
||||
# register yunohost service
|
||||
yunohost service add seafile
|
||||
yunohost service add seahub
|
||||
|
||||
ynh_script_progression --message="Stoping services..." --weight=3
|
||||
|
||||
# Start service
|
||||
ynh_script_progression --message="Starting seafile services..." --weight=3
|
||||
sleep 3
|
||||
|
||||
ynh_script_progression --message="Starting seafile services..."
|
||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
sleep 2
|
||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||
sleep 2
|
||||
|
||||
# Add fail2ban
|
||||
ynh_script_progression --message="Configuring fail2ban..." --weight=10
|
||||
ynh_add_fail2ban_config --use_template
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -11,11 +11,6 @@ source ./_common.sh
|
|||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
|
@ -37,27 +32,18 @@ ynh_secure_remove --file=/var/log/seafile
|
|||
ynh_script_progression --message="Removing code..."
|
||||
ynh_secure_remove --file=/var/www/$app
|
||||
ynh_secure_remove --file=/opt/yunohost/$app
|
||||
ynh_secure_remove --file=/tmp/seahub_cache
|
||||
|
||||
# Remove databases
|
||||
ynh_script_progression --message="Removing databases..."
|
||||
ynh_mysql_remove_db --db_name ccnetdb --db_user seafile
|
||||
ynh_mysql_remove_db --db_name seafiledb --db_user seafile
|
||||
ynh_mysql_remove_db --db_name seahubdb --db_user seafile
|
||||
db_helper=ynh_"mysql"_remove_db
|
||||
$db_helper --db_name ccnetdb --db_user seafile
|
||||
$db_helper --db_name seahubdb --db_user seafile
|
||||
|
||||
# Remove systemd service
|
||||
ynh_script_progression --message="Removing systemd units..."
|
||||
ynh_remove_systemd_config --service seafile
|
||||
ynh_remove_systemd_config --service seahub
|
||||
|
||||
# Remove user
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
ynh_system_user_delete --username seafile
|
||||
|
||||
# Remove depandance
|
||||
ynh_script_progression --message="Removing dependencies" --weight=10
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
# Remove nginx config
|
||||
ynh_script_progression --message="Removing nginx configuration..."
|
||||
ynh_remove_nginx_config
|
||||
|
@ -73,7 +59,5 @@ ynh_script_progression --message="Removing seafile service..."
|
|||
yunohost service remove seafile
|
||||
yunohost service remove seahub
|
||||
|
||||
ynh_print_info --message="Due of the backup core only feature the data directory in '/home/yunohost.app/seafile-data' was not removed. It need to be removed manually to purge app user data."
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
sleep 1
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
import json
|
||||
import sys
|
||||
|
||||
with open("/etc/ssowat/" + "conf.json.persistent", "r", encoding='utf-8') as jsonFile:
|
||||
data = json.load(jsonFile)
|
||||
|
||||
for domain in ("", sys.argv[1]):
|
||||
for path in ("/seafhttp", "/seafdav"):
|
||||
url = domain + path
|
||||
try:
|
||||
uri_list = data["skipped_urls"]
|
||||
while url in uri_list:
|
||||
uri_list.remove(url)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
uri_list = data["protected_urls"]
|
||||
while url in uri_list:
|
||||
uri_list.remove(url)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
uri_list = data["permissions"]["custom_protected"]["uris"]
|
||||
while url in uri_list:
|
||||
uri_list.remove(url)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
uri_list = data["permissions"]["custom_skipped"]["uris"]
|
||||
while url in uri_list:
|
||||
uri_list.remove(url)
|
||||
except:
|
||||
pass
|
||||
|
||||
with open("/etc/ssowat/" + "conf.json.persistent", "w", encoding='utf-8') as jsonFile:
|
||||
jsonFile.write(json.dumps(data, indent=4, sort_keys=True))
|
|
@ -11,19 +11,10 @@ source ../settings/scripts/_common.sh
|
|||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
ynh_script_progression --message="Loading settings..."
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path))
|
||||
seafile_data=/home/yunohost.app/seafile-data
|
||||
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||
seafile_version=$(ynh_app_upstream_version)
|
||||
seafile_user=$app
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -33,22 +24,13 @@ seafile_user=$app
|
|||
ynh_script_progression --message="Restoring files..." --weight=10
|
||||
ynh_restore
|
||||
|
||||
# Create user
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
ynh_system_user_create --username $seafile_user --home_dir $final_path
|
||||
|
||||
# Restore dependencies
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
||||
install_dependance
|
||||
|
||||
# Restore mysql dump
|
||||
ynh_script_progression --message="Restoring database..." --weight=3
|
||||
db_user=seafile
|
||||
ynh_mysql_setup_db --db_user $db_user --db_name ccnetdb --db_pwd "$db_pwd"
|
||||
ynh_mysql_setup_db --db_user $db_user --db_name seafiledb --db_pwd "$db_pwd"
|
||||
ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
|
||||
db_helper=ynh_"mysql"_setup_db
|
||||
$db_helper --db_user $db_user --db_name ccnetdb --db_pwd "$db_pwd"
|
||||
$db_helper --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
|
||||
su -c "mysql -u ${app} -p$db_pwd $db_name < ${YNH_CWD}/seafiledb.dmp"
|
||||
su -c "mysql -u ${app} -p$db_pwd ccnetdb < ${YNH_CWD}/ccnetdb.dmp"
|
||||
su -c "mysql -u ${app} -p$db_pwd seafiledb < ${YNH_CWD}/seafiledb.dmp"
|
||||
su -c "mysql -u ${app} -p$db_pwd seahubdb < ${YNH_CWD}/seahubdb.dmp"
|
||||
|
||||
#=================================================
|
||||
|
@ -57,8 +39,8 @@ su -c "mysql -u ${app} -p$db_pwd seahubdb < ${YNH_CWD}/seahubdb.dmp"
|
|||
|
||||
# Add logrotate
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
ynh_use_logrotate --logfile $final_path/logs
|
||||
ln -s $final_path/logs /var/log/seafile
|
||||
ynh_use_logrotate --logfile $install_dir/logs
|
||||
ln -s $install_dir/logs /var/log/seafile
|
||||
|
||||
# Set all permissions
|
||||
ynh_script_progression --message="Protecting directory..."
|
||||
|
|
274
scripts/upgrade
274
scripts/upgrade
|
@ -11,26 +11,20 @@ source ./_common.sh
|
|||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path))
|
||||
seahub_port=$(ynh_app_setting_get --app $app --key seahub_port)
|
||||
fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port)
|
||||
webdav_port=$(ynh_app_setting_get --app $app --key webdav_port)
|
||||
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||
seafile_user=$app
|
||||
seafile_data=/home/yunohost.app/seafile-data
|
||||
installed_version=${YNH_APP_CURRENT_VERSION/~ynh*/}
|
||||
seafile_version=$(ynh_app_upstream_version)
|
||||
|
||||
# Create special path with / at the end
|
||||
if [[ $path == '/' ]]
|
||||
then
|
||||
path2=$path
|
||||
else
|
||||
path2=$path"/"
|
||||
fi
|
||||
|
||||
if [ "$YNH_APP_CURRENT_VERSION" == '-' ]; then
|
||||
YNH_APP_CURRENT_VERSION="6.0.9~ynh0"
|
||||
installed_version=${YNH_APP_CURRENT_VERSION/~ynh*/}
|
||||
ynh_die "Upgrade from this version not supported"
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Stoping services..."
|
||||
|
@ -53,60 +47,30 @@ pkill -f seaf-server || true
|
|||
pkill -f ccnet-server || true
|
||||
pkill -f seahub || true
|
||||
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30
|
||||
# Backup the current version of the app
|
||||
if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ] \
|
||||
&& (ynh_compare_current_package_version --comparison=ge --version='7.0.5~ynh1')
|
||||
then
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Clean installation remainings that are not handled by the remove script.
|
||||
ynh_clean_check_starting
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Migrate DB name if needed
|
||||
if mysqlshow | grep -q seafiledb; then
|
||||
mysqlconn="mysql -u root"
|
||||
sql_mv_params=$($mysqlconn -N -e "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES \
|
||||
WHERE table_schema='seafiledb'")
|
||||
for name in $sql_mv_params; do
|
||||
$mysqlconn -e "RENAME TABLE seafiledb.$name to $db_name.$name";
|
||||
done;
|
||||
$mysqlconn -e "DROP DATABASE seafiledb"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# MIGRATION FROM OLD VERSION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Fixing old settings..." --weight=1
|
||||
|
||||
# Get configuration for user and final path
|
||||
if [ -z $final_path ]; then
|
||||
if [ -e /var/www/$app ]; then
|
||||
final_path=/var/www/$app
|
||||
elif [ -e /opt/yunohost/$app ]; then
|
||||
final_path=/opt/yunohost/$app
|
||||
else
|
||||
ynh_die --message "Error : can't find seafile path"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $final_path == "/var/www/$app" ]; then
|
||||
final_path="/opt/yunohost/$app"
|
||||
mkdir -p /opt/yunohost
|
||||
mv /var/www/$app /opt/yunohost/$app
|
||||
ynh_system_user_create --username $seafile_user --home_dir $final_path
|
||||
ynh_app_setting_set --app $app --key final_path --value $final_path
|
||||
test -e /var/log/seafile && rm /var/log/$app
|
||||
if ! [ -z "$(ls -A $final_path/seafile_data)" ]; then
|
||||
# Data directory NOT empty, transfer data to /home/yunohost.app/seafile
|
||||
mv $final_path/seafile_data/* /home/yunohost.app/seafile-data/
|
||||
ynh_secure_remove $final_path/seafile_data
|
||||
ln -s /home/yunohost.app/seafile-data $final_path/
|
||||
fi
|
||||
ln -s $final_path/logs /var/log/seafile
|
||||
# Set missing settings
|
||||
if [ -z ${seahub_secret_key:-} ]; then
|
||||
seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2)
|
||||
ynh_app_setting_set --app $app --key seahub_secret_key --value $seahub_secret_key
|
||||
fi
|
||||
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=6
|
||||
|
||||
# extract new version
|
||||
test -e $final_path/seafile-server-$seafile_version && ynh_secure_remove --file="$final_path/seafile-server-$seafile_version"
|
||||
install_source
|
||||
# Download new version from sources
|
||||
ynh_script_progression --message="Installing sources files..." --weight=7
|
||||
ynh_setup_source --dest_dir=$install_dir/seafile-server-$seafile_version
|
||||
|
||||
# Upgrade dependances
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
ynh_script_progression --message="Installing python dependancies..."
|
||||
install_dependance
|
||||
|
||||
ynh_script_progression --message="Configuring application..."
|
||||
|
@ -114,164 +78,60 @@ ynh_script_progression --message="Configuring application..."
|
|||
# permission to execute update script and expect helper
|
||||
mv_expect_scripts
|
||||
set_permission
|
||||
chmod u+x,o= $final_path/seafile-server-$seafile_version/upgrade/upgrade_*.sh
|
||||
chmod u+x,o= $final_path/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
||||
chmod u+x,o= $install_dir/seafile-server-$seafile_version/upgrade/upgrade_*.sh
|
||||
chmod u+x,o= $install_dir/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
|
||||
|
||||
# do the upgrade ( the ";&" syntax mean when it go in the first case which is true it do all the next case)
|
||||
case $installed_version in
|
||||
"4.0."* )
|
||||
"4."* )
|
||||
# Update seafile by script
|
||||
ynh_die "Upgrade form the version 4.0 was removed. Upgrade from this version won't be supported any more."
|
||||
ynh_die "Upgrade form the version 4.x was removed. Upgrade from this version won't be supported any more."
|
||||
;&
|
||||
"4.1."* )
|
||||
"5."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_4.2.1.exp $final_path/seafile-server-7.0.5
|
||||
ynh_die "Upgrade form the version 5.x was removed. Upgrade from this version won't be supported any more."
|
||||
;&
|
||||
"4.3."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_4.4.3.exp $final_path/seafile-server-7.0.5
|
||||
;&
|
||||
"4.4."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_5.0.3.exp $final_path/seafile-server-7.0.5
|
||||
;&
|
||||
"5.0."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_5.1.exp $final_path/seafile-server-7.0.5
|
||||
;&
|
||||
"5.1."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_6.0.exp $final_path/seafile-server-7.0.5
|
||||
;&
|
||||
"6.0."* )
|
||||
install_source_7_0
|
||||
|
||||
# Update seafile by script
|
||||
$expect_scripts_dir/upgrade_6.1.exp $final_path/seafile-server-7.0.5
|
||||
|
||||
# Enable manually wiki
|
||||
echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py
|
||||
;&
|
||||
"6.1."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_6.2.exp $final_path/seafile-server-7.0.5
|
||||
;&
|
||||
"6.2."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_6.3.exp $final_path/seafile-server-7.0.5
|
||||
|
||||
# Update logrotate to have the last version
|
||||
ynh_use_logrotate --logfile $final_path/logs --nonappend
|
||||
;&
|
||||
"6.3."* )
|
||||
# Update seafile by script
|
||||
install_source_7_0
|
||||
$expect_scripts_dir/upgrade_7.0.exp $final_path/seafile-server-7.0.5
|
||||
# SSO authentication
|
||||
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "REMOTE_USER_HEADER = 'HTTP_EMAIL'" | tee -a $final_path/conf/seahub_settings.py
|
||||
echo 'REMOTE_USER_CREATE_UNKNOWN_USER = False' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "REMOTE_USER_PROTECTED_PATH = ['$path_url', '$path_url/accounts/login']" | tee -a $final_path/conf/seahub_settings.py
|
||||
|
||||
# Clean connexion from the SSO. If we don't do this we could have some when the user was loged by the old SSO auth mecanisme
|
||||
ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb
|
||||
|
||||
ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user."
|
||||
"6."* )
|
||||
ynh_die "Upgrade form the version 6.x was removed. Upgrade from this version won't be supported any more."
|
||||
;&
|
||||
"7.0"* )
|
||||
# Fix file comment
|
||||
pushd $final_path/seafile-server-$seafile_version
|
||||
sudo -u $seafile_user $final_path/seafile-server-$seafile_version/seahub.sh python-env python3 seahub/manage.py migrate_file_comment
|
||||
pushd $install_dir/seafile-server-$seafile_version
|
||||
sudo -u $YNH_APP_ID $install_dir/seafile-server-$seafile_version/seahub.sh python-env python3 seahub/manage.py migrate_file_comment
|
||||
popd
|
||||
|
||||
# Update seafile by script
|
||||
sudo -u $seafile_user $expect_scripts_dir/upgrade_7.1.exp $final_path/seafile-server-$seafile_version
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_7.1.exp $install_dir/seafile-server-$seafile_version
|
||||
|
||||
ynh_secure_remove --file="$final_path/seafile-server-7.0.5"
|
||||
|
||||
# Enable memcached
|
||||
cat >> $final_path/conf/seahub_settings.py <<EOF
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
},
|
||||
}
|
||||
EOF
|
||||
# Fix seafile data link. Look like that the upgrade script of seafile don't always work correctly
|
||||
if [ -e $final_path/seafile-data ]; then
|
||||
old_data_dir_path="$final_path/seafile_data$(date '+%Y%m%d.%H%M%S')"
|
||||
mv "$final_path/seafile-data" "$old_data_dir_path"
|
||||
if [ -e $install_dir/seafile-data ]; then
|
||||
old_data_dir_path="$install_dir/seafile_data$(date '+%Y%m%d.%H%M%S')"
|
||||
mv "$install_dir/seafile-data" "$old_data_dir_path"
|
||||
fi
|
||||
ln -s $seafile_data $final_path/seafile-data
|
||||
ln -s $seafile_data $install_dir/seafile-data
|
||||
;&
|
||||
"7.1."* )
|
||||
sudo -u $seafile_user $expect_scripts_dir/upgrade_8.0.exp $final_path/seafile-server-$seafile_version
|
||||
echo "FILTER = permission=cn=$app.main,ou=permission,dc=yunohost,dc=org" | tee -a $final_path/conf/ccnet.conf
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_8.0.exp $install_dir/seafile-server-$seafile_version
|
||||
;&
|
||||
"8.0."* )
|
||||
sudo -u $seafile_user $expect_scripts_dir/upgrade_9.0.exp $final_path/seafile-server-$seafile_version
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_9.0.exp $install_dir/seafile-server-$seafile_version
|
||||
;&
|
||||
esac
|
||||
|
||||
sudo -u $seafile_user $expect_scripts_dir/minor-upgrade.exp $final_path/seafile-server-$seafile_version
|
||||
sudo -u $YNH_APP_ID $expect_scripts_dir/minor-upgrade.exp $install_dir/seafile-server-$seafile_version
|
||||
|
||||
## Install webdav and logrotate if not installed
|
||||
if [[ $installed_version = "4.0."* ]] || [[ $installed_version = "4.1."* ]]
|
||||
then
|
||||
ynh_script_progression --message="Configuring webdav..."
|
||||
webdav_port=$(ynh_find_port 8080)
|
||||
ynh_app_setting_set --app $app --key webdav_port --value $webdav_port
|
||||
|
||||
# Disallow port that was used by old seafile client
|
||||
ccnet_port=$(ynh_app_setting_get --app $app --key ccnet_port)
|
||||
seafile_port=$(ynh_app_setting_get --app $app --key seafile_port)
|
||||
yunohost firewall disallow Both $ccnet_port
|
||||
yunohost firewall disallow Both $seafile_port
|
||||
|
||||
# Add webdav config
|
||||
cp ../conf/seafdav.conf $final_path/conf/seafdav.conf
|
||||
ynh_replace_string --match_string __WEBDAV_PORT__ --replace_string $webdav_port --target_file $final_path/conf/seafdav.conf
|
||||
|
||||
# Update seafile config
|
||||
echo 'COMPRESS_URL = MEDIA_URL' | tee -a $final_path/conf/seahub_settings.py
|
||||
echo "STATIC_URL = MEDIA_URL + 'assets/'" | tee -a $final_path/conf/seahub_settings.py
|
||||
fi
|
||||
# Clean url in config in DB
|
||||
clean_url_in_db_config
|
||||
|
||||
# Update seahub config for old version to version 5.0.4
|
||||
if [[ $(grep -c "LOGIN_URL" $final_path/conf/seahub_settings.py) == 0 ]]
|
||||
then
|
||||
echo "LOGIN_URL = '$path_url/accounts/login/'" | tee -a $final_path/conf/seahub_settings.py
|
||||
fi
|
||||
|
||||
if [ $(grep -c "TIME_ZONE" $final_path/conf/seahub_settings.py) == 0 ]
|
||||
then
|
||||
echo "TIME_ZONE = \"$(cat /etc/timezone)\"" | tee -a $final_path/conf/seahub_settings.py
|
||||
fi
|
||||
# Update seafile config files
|
||||
ynh_add_config --template=seahub_settings.py --destination=$install_dir/conf/seahub_settings.py
|
||||
ynh_add_config --template=seafile.conf --destination=$install_dir/conf/seafile.conf
|
||||
ynh_add_config --template=ccnet.conf --destination=$install_dir/conf/ccnet.conf
|
||||
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py
|
||||
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf
|
||||
|
||||
# Fix local warning
|
||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $final_path/seafile-server-$seafile_version/seahub.sh
|
||||
|
||||
# Update gunicorn config
|
||||
sed --in-place -r "s@bind = \"0\.0\.0\.0:[[:digit:]]+\"@bind = \"0.0.0.0:$seahub_port\"@g" $final_path/conf/gunicorn.conf.py
|
||||
|
||||
# In the 3.x seafile version package the seahub_port and fileserver_port wasn't saved in the settings. If the settings is empty we try to get it and save in the settings
|
||||
|
||||
if [[ -z $seahub_port ]] || [[ -z $fileserver_port ]]
|
||||
then
|
||||
seahub_port=$(head -n 20 /etc/nginx/conf.d/$domain.d/seafile.conf | grep -E "fastcgi_pass.*127.0.0.1:" | cut -d':' -f2 | cut -d';' -f1)
|
||||
fileserver_port=$(head -n 50 /etc/nginx/conf.d/$domain.d/seafile.conf | grep -E "proxy_pass.*127.0.0.1:" | cut -d':' -f3 | cut -d';' -f1 | cut -d'/' -f1)
|
||||
|
||||
ynh_app_setting_set --app $app --key seahub_port --value $seahub_port
|
||||
ynh_app_setting_set --app $app --key fileserver_port --value $fileserver_port
|
||||
fi
|
||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $install_dir/seafile-server-$seafile_version/seahub.sh
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -295,53 +155,33 @@ set_permission
|
|||
|
||||
# Add logrotate
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
ynh_use_logrotate --logfile $final_path/logs --nonappend
|
||||
ynh_use_logrotate --logfile $install_dir/logs --nonappend
|
||||
|
||||
# Add fail2ban
|
||||
ynh_script_progression --message="Configuring fail2ban..." --weight=10
|
||||
ynh_add_fail2ban_config --use_template
|
||||
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
ynh_legacy_permissions_delete_all
|
||||
if ! ynh_permission_exists --permission=file_server; then
|
||||
ynh_permission_create --permission=file_server --url=$domain/seafhttp --auth_header=false \
|
||||
--label="File server" --protected=true --allowed=visitors
|
||||
ynh_permission_create --permission=webdav --url=$domain/seafdav --auth_header=true \
|
||||
--label="Webdav" --protected=true --allowed=visitors
|
||||
ynh_permission_create --permission=media --url=/media --auth_header=true \
|
||||
--label="Media" --protected=true --allowed=visitors
|
||||
python3 remove_sso_conf_persistent.py $domain \
|
||||
|| ynh_print_warn --message="Your file /etc/ssowat/""conf.json.persistent doesn't respect the json syntax. The config file wasn't cleaned. Please clean it manually."
|
||||
else
|
||||
ynh_permission_url --permission=file_server --url=$domain/seafhttp --auth_header=false
|
||||
ynh_permission_update --permission=file_server --label="File server" --show_tile=false --protected=true
|
||||
ynh_permission_url --permission=webdav --url=$domain/seafdav --auth_header=false
|
||||
ynh_permission_update --permission=webdav --label="Webdav" --show_tile=false --protected=true
|
||||
ynh_permission_url --permission=media --url=/media --auth_header=true
|
||||
ynh_permission_update --permission=media --label="Media" --show_tile=false --protected=true
|
||||
fi
|
||||
|
||||
# register yunohost service
|
||||
ynh_script_progression --message="Register seafile service..."
|
||||
yunohost service add seafile
|
||||
yunohost service add seahub
|
||||
|
||||
# delete seafile cache
|
||||
ynh_secure_remove --file=/tmp/seahub_cache
|
||||
|
||||
# restart seafile server
|
||||
ynh_script_progression --message="Starting seafile services..." --weight=3
|
||||
sleep 5
|
||||
ynh_systemd_action --service_name memcached.service -p "systemd"
|
||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||
sleep 2
|
||||
|
||||
# remove old version files
|
||||
ynh_script_progression --message="Cleaning system and updating settings..."
|
||||
ls $final_path | grep "seafile-server-" | egrep -v "(${seafile_version//./\\.})|(latest)" | \
|
||||
ls $install_dir | grep "seafile-server-" | egrep -v "(${seafile_version//./\\.})|(latest)" | \
|
||||
while read f
|
||||
do
|
||||
ynh_secure_remove --file=$final_path/$f
|
||||
ynh_secure_remove --file=$install_dir/$f
|
||||
done
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
25
tests.toml
Normal file
25
tests.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||
|
||||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
|
||||
# -------------------------------
|
||||
# Default args to use for install
|
||||
# -------------------------------
|
||||
|
||||
args.server_name = "Seafile"
|
||||
args.admin_password = "Sup3rS3cr3t"
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.b5fd940.name = "Pre packaging v2"
|
||||
test_upgrade_from.3ce35d3.name = "Version 7.1 Old version for CI 4 branch"
|
||||
test_upgrade_from.97c0b2f.name = "Version 8.x Old version for CI 5 branch"
|
Loading…
Reference in a new issue