mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
Merge pull request #28 from YunoHost-Apps/2021.07.06
Upgrade to StandardNotes Standalone 2021.07.06
This commit is contained in:
commit
d69f630c9b
72 changed files with 1407 additions and 1081 deletions
28
README.md
28
README.md
|
@ -1,7 +1,3 @@
|
|||
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
|
@ -10,45 +6,39 @@ It shall NOT be edited by hand.
|
|||
# Standard Notes Server for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/snserver)  
|
||||
[](https://install-app.yunohost.org/?app=snserver)
|
||||
[](https://install-app.yunohost.org/?app=snserver)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install snserver quickly and simply on a YunoHost server.
|
||||
> *This package allows you to install Standard Notes Server quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
|
||||
The Standard Notes syncing server. An end-to-end encrypted note-taking app.
|
||||
|
||||
**Shipped version:** 3.22.8~ynh2
|
||||
**Shipped version:** 2021.07.06~ynh1
|
||||
|
||||
**Demo:** https://standardnotes.org/demo
|
||||
|
||||
|
||||
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
||||
* No single-sign on or LDAP integration
|
||||
* The app requires up 600MB of RAM to install
|
||||
* The app requires at least 110MB of RAM to work properly. And will increase with use.
|
||||
* The app requires around 300MB of disk.
|
||||
* The app requires at least 450MB of RAM to work properly.
|
||||
* The app requires at least 650MB of RAM to start.
|
||||
* The app requires around 1800MB of disk.
|
||||
|
||||
* Other infos that people should be aware of, such as:
|
||||
* The config-file is stored under "/opt/yunohost/$app/live/.env"
|
||||
* You can find additional config features under https://your-domain.tld/yunohost/admin/#/apps/$app/config-panel
|
||||
* The ".env" config-files are stored under "/opt/yunohost/$app/live/"
|
||||
* You can change the url of this app, but than all useres have to reinstall the extensions.
|
||||
|
||||
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://standardnotes.org/
|
||||
* Official user documentation: https://docs.standardnotes.org/
|
||||
* Official user documentation: https://standardnotes.com/help
|
||||
* Official admin documentation: https://docs.standardnotes.org/
|
||||
* Upstream app code repository: https://github.com/standardnotes/syncing-server
|
||||
* Upstream app code repository: https://github.com/standardnotes/standalone
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_snserver
|
||||
* Report a bug: https://github.com/YunoHost-Apps/snserver_ynh/issues
|
||||
|
||||
|
|
40
README_fr.md
40
README_fr.md
|
@ -1,48 +1,42 @@
|
|||
# Standard Notes Server pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/snserver)  
|
||||
[](https://install-app.yunohost.org/?app=snserver)
|
||||
[](https://install-app.yunohost.org/?app=snserver)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install snserver quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
> *Ce package vous permet d'installer Standard Notes Server rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
|
||||
|
||||
**Version incluse:** 3.22.8~ynh2
|
||||
|
||||
**Démo:** https://standardnotes.org/demo
|
||||
|
||||
|
||||
**Version incluse :** 2021.07.06~ynh1
|
||||
|
||||
**Démo :** https://standardnotes.org/demo
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
||||
* No single-sign on or LDAP integration
|
||||
* The app requires up 600MB of RAM to install
|
||||
* The app requires at least 110MB of RAM to work properly. And will increase with use.
|
||||
* The app requires around 300MB of disk.
|
||||
* The app requires at least 450MB of RAM to work properly.
|
||||
* The app requires at least 650MB of RAM to start.
|
||||
* The app requires around 1800MB of disk.
|
||||
|
||||
* Other infos that people should be aware of, such as:
|
||||
* The config-file is stored under "/opt/yunohost/$app/live/.env"
|
||||
* You can find additional config features under https://your-domain.tld/yunohost/admin/#/apps/$app/config-panel
|
||||
* The ".env" config-files are stored under "/opt/yunohost/$app/live/"
|
||||
* You can change the url of this app, but than all useres have to reinstall the extensions.
|
||||
|
||||
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site official de l'app : https://standardnotes.org/
|
||||
* Documentation officielle utilisateur: https://docs.standardnotes.org/
|
||||
* Documentation officielle de l'admin: https://docs.standardnotes.org/
|
||||
* Dépôt de code officiel de l'app: https://github.com/standardnotes/syncing-server
|
||||
* Documentation YunoHost pour cette app: https://yunohost.org/app_snserver
|
||||
* Signaler un bug: https://github.com/YunoHost-Apps/snserver_ynh/issues
|
||||
* Site officiel de l'app : https://standardnotes.org/
|
||||
* Documentation officielle utilisateur : https://standardnotes.com/help
|
||||
* Documentation officielle de l'admin : https://docs.standardnotes.org/
|
||||
* Dépôt de code officiel de l'app : https://github.com/standardnotes/standalone
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_snserver
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/snserver_ynh/issues
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -51,8 +45,8 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
|
|||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/snserver_ynh/tree/testing --debug
|
||||
or
|
||||
ou
|
||||
sudo yunohost app upgrade snserver -u https://github.com/YunoHost-Apps/snserver_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications:** https://yunohost.org/packaging_apps
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -5,18 +5,18 @@
|
|||
|
||||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
access_domain="/"
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_private=0
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 3.22.8~yhn2
|
||||
upgrade=1 from_commit=b0c7e9e6f16d286ec74fa3c1b9cdf8492f4dcb9b
|
||||
# 3.22.8~yhn1
|
||||
#upgrade=1 from_commit=c9ea83e8102affd5ca74a6d438920fa40af4a63e
|
||||
# 3.20.5~ynh2
|
||||
|
@ -29,21 +29,13 @@
|
|||
#upgrade=1 from_commit=7474baadc1705ffe5981a52bdced16bdd1edf979
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
|
||||
# incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=
|
||||
;;; Upgrade options
|
||||
; commit=c9ea83e8102affd5ca74a6d438920fa40af4a63e
|
||||
name=3.22.8~ynh1
|
||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1
|
||||
; commit=e8db15c97db16f68d6453970a9dff74d5136017b
|
||||
name=3.20.5~ynh2
|
||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1
|
||||
; commit=b0c7e9e6f16d286ec74fa3c1b9cdf8492f4dcb9b
|
||||
name=3.22.8~ynh2
|
||||
manifest_arg=domain=DOMAIN&path=PATH=1
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/syncing-server/archive/3.22.8.zip
|
||||
SOURCE_SUM=DBAB9503D2E52392DB1A272D3C00AE267C9515119F48E2F20BF56E44FA1ECD28
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
5
conf/app_api-gateway.src
Normal file
5
conf/app_api-gateway.src
Normal file
|
@ -0,0 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/api-gateway/archive/1.20.0.tar.gz
|
||||
SOURCE_SUM=d99dcf7b623a7b68b5c9e284fe05511c7b17c3398fe37082609c811cf8b83654
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
5
conf/app_auth.src
Normal file
5
conf/app_auth.src
Normal file
|
@ -0,0 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/auth/archive/1.11.1.tar.gz
|
||||
SOURCE_SUM=99ded0f0dfe65b1e98c332e149a52a11e2523e249ea3a0f6aa30bf3e3b55e9f6
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
5
conf/app_syncing-server-js.src
Normal file
5
conf/app_syncing-server-js.src
Normal file
|
@ -0,0 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/syncing-server-js/archive/1.35.2.tar.gz
|
||||
SOURCE_SUM=45a6f740872880d5144a020821d267b9712ea590d176f9a3a1b1ab655aaedce0
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
|
@ -1,85 +0,0 @@
|
|||
# Sample ENV setup Variables
|
||||
# Copy this file and update as needed.
|
||||
#
|
||||
# $ cp .env.sample .env
|
||||
#
|
||||
# Do not include this new file in source control
|
||||
#
|
||||
|
||||
# Rails Settings
|
||||
EXPOSED_PORT=3000
|
||||
# change this to "production" for production use, otherwise the access token time is very short and forces re-login
|
||||
RAILS_ENV=development
|
||||
RAILS_LOG_TO_STDOUT=false
|
||||
# Log Level options: "INFO" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL"
|
||||
RAILS_LOG_LEVEL=INFO
|
||||
#SQS_QUEUE=somequeue
|
||||
#SQS_QUEUE_LOW_PRIORITY=low_priority_queue
|
||||
#AWS_REGION=us-west1
|
||||
#S3_BACKUP_BUCKET_NAME=
|
||||
|
||||
ACTIVE_JOB_QUEUE_ADAPTER=async
|
||||
|
||||
# Database Settings
|
||||
DB_PORT=3306
|
||||
DB_HOST=127.0.0.1
|
||||
DB_DATABASE=standard_notes_db
|
||||
DB_USERNAME=std_notes_user
|
||||
# Please change this!
|
||||
DB_PASSWORD=changeme123
|
||||
DB_POOL_SIZE=30
|
||||
DB_WAIT_TIMEOUT=180
|
||||
|
||||
# Secrets
|
||||
# Use: "bundle exec rake secret" or "openssl rand -hex 64"
|
||||
# To generate required secret key base below
|
||||
|
||||
SECRET_KEY_BASE=changeme123
|
||||
PSEUDO_KEY_PARAMS_KEY=changeme456
|
||||
|
||||
# Disable user registration
|
||||
#DISABLE_USER_REGISTRATION=true
|
||||
|
||||
# Datadog
|
||||
DATADOG_ENABLED=false
|
||||
|
||||
# Mailer settings
|
||||
SMTP_HOST=
|
||||
SMTP_PORT=
|
||||
#SMTP_USERNAME=
|
||||
#SMTP_PASSWORD=
|
||||
SMTP_DOMAIN=
|
||||
# Enalbe STARTTLS
|
||||
# Empty is disabled
|
||||
# Any value is enabled
|
||||
SMTP_STARTTLS=
|
||||
EMAIL_ATTACHMENT_MAX_SIZE=10485760
|
||||
|
||||
# SNS EVENTS
|
||||
#SNS_TOPIC_ARN=
|
||||
|
||||
# (Optional) Database Replication
|
||||
#DB_REPLICA_HOST=
|
||||
|
||||
# Revisions persistency
|
||||
REVISIONS_FREQUENCY=300
|
||||
|
||||
# (Optional) Redis Cache for ephemeral sessions
|
||||
REDIS_URL=redis://cache:6379
|
||||
|
||||
# (Optional) Change URLs to Internal DNS
|
||||
#INTERNAL_DNS_REROUTE_ENABLED=false
|
||||
|
||||
# (Optional) Auth Proxy JWT Secret
|
||||
#AUTH_JWT_SECRET=changeme123
|
||||
|
||||
# (Optional) User Management Server - registration emails, subscriptions etc.
|
||||
#USER_MANAGEMENT_SERVER=
|
||||
|
||||
# Sub-URI
|
||||
RAILS_RELATIVE_URL_ROOT=/
|
||||
|
||||
# Public file server
|
||||
# Empty is disabled
|
||||
# Any value is enabled
|
||||
RAILS_SERVE_STATIC_FILES=
|
23
conf/env_api-gateway.env.sample
Normal file
23
conf/env_api-gateway.env.sample
Normal file
|
@ -0,0 +1,23 @@
|
|||
__YNH_NODE_LOAD_PATH__
|
||||
|
||||
LOG_LEVEL="info"
|
||||
NODE_ENV="production"
|
||||
|
||||
PORT="__PORT_API_GATEWAY__"
|
||||
|
||||
SYNCING_SERVER_JS_URL="http://localhost:__PORT_SYNCING_SERVER_JS__"
|
||||
AUTH_SERVER_URL="http://localhost:__PORT_AUTH__"
|
||||
#PAYMENTS_SERVER_URL=http://payments:3000
|
||||
|
||||
HTTP_CALL_TIMEOUT=10000
|
||||
|
||||
AUTH_JWT_SECRET=__AUTH_JWT_SECRET__
|
||||
|
||||
# (Optional) New Relic Setup
|
||||
NEW_RELIC_ENABLED=false
|
||||
NEW_RELIC_APP_NAME="API Gateway"
|
||||
NEW_RELIC_LICENSE_KEY=
|
||||
NEW_RELIC_NO_CONFIG_FILE=true
|
||||
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
|
||||
NEW_RELIC_LOG_ENABLED=false
|
||||
NEW_RELIC_LOG_LEVEL=info
|
59
conf/env_auth-worker.env.sample
Normal file
59
conf/env_auth-worker.env.sample
Normal file
|
@ -0,0 +1,59 @@
|
|||
__YNH_NODE_LOAD_PATH__
|
||||
|
||||
LOG_LEVEL="info"
|
||||
NODE_ENV="production"
|
||||
|
||||
JWT_SECRET=__JWT_SECRET__
|
||||
LEGACY_JWT_SECRET=__LEGACY_JWT_SECRET__
|
||||
AUTH_JWT_SECRET=__AUTH_JWT_SECRET__
|
||||
AUTH_JWT_TTL=60000
|
||||
|
||||
# Must be a hex string exactly 32 bytes long
|
||||
# e.g. feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
|
||||
ENCRYPTION_SERVER_KEY=__ENCRYPTION_SERVER_KEY__
|
||||
|
||||
PORT="__PORT_AUTH_WORKER__"
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_REPLICA_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_USERNAME=__DB_USER__
|
||||
DB_PASSWORD=__DB_PWD__
|
||||
DB_DATABASE=__DB_NAME__
|
||||
DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"
|
||||
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
||||
|
||||
REDIS_URL=redis://localhost:6379/__REDIS_DB__
|
||||
|
||||
DISABLE_USER_REGISTRATION=false
|
||||
|
||||
ACCESS_TOKEN_AGE=5184000
|
||||
REFRESH_TOKEN_AGE=31556926
|
||||
|
||||
EPHEMERAL_SESSION_AGE=259200
|
||||
|
||||
MAX_LOGIN_ATTEMPTS=6
|
||||
FAILED_LOGIN_LOCKOUT=3600
|
||||
|
||||
PSEUDO_KEY_PARAMS_KEY=__PSEUDO_KEY_PARAMS_KEY__
|
||||
|
||||
SNS_TOPIC_ARN=
|
||||
SNS_AWS_REGION=
|
||||
SQS_QUEUE_URL=
|
||||
SQS_AWS_REGION=
|
||||
|
||||
USER_SERVER_REGISTRATION_URL=
|
||||
USER_SERVER_AUTH_KEY=
|
||||
|
||||
SYNCING_SERVER_URL=http://localhost:__PORT_SYNCING_SERVER_JS__
|
||||
|
||||
REDIS_EVENTS_CHANNEL=events
|
||||
|
||||
# (Optional) New Relic Setup
|
||||
NEW_RELIC_ENABLED=false
|
||||
NEW_RELIC_APP_NAME=Auth
|
||||
NEW_RELIC_LICENSE_KEY=
|
||||
NEW_RELIC_NO_CONFIG_FILE=true
|
||||
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
|
||||
NEW_RELIC_LOG_ENABLED=false
|
||||
NEW_RELIC_LOG_LEVEL=info
|
59
conf/env_auth.env.sample
Normal file
59
conf/env_auth.env.sample
Normal file
|
@ -0,0 +1,59 @@
|
|||
__YNH_NODE_LOAD_PATH__
|
||||
|
||||
LOG_LEVEL="info"
|
||||
NODE_ENV="production"
|
||||
|
||||
JWT_SECRET=__JWT_SECRET__
|
||||
LEGACY_JWT_SECRET=__LEGACY_JWT_SECRET__
|
||||
AUTH_JWT_SECRET=__AUTH_JWT_SECRET__
|
||||
AUTH_JWT_TTL=60000
|
||||
|
||||
# Must be a hex string exactly 32 bytes long
|
||||
# e.g. feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
|
||||
ENCRYPTION_SERVER_KEY=__ENCRYPTION_SERVER_KEY__
|
||||
|
||||
PORT="__PORT_AUTH__"
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_REPLICA_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_USERNAME=__DB_USER__
|
||||
DB_PASSWORD=__DB_PWD__
|
||||
DB_DATABASE=__DB_NAME__
|
||||
DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"
|
||||
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
||||
|
||||
REDIS_URL=redis://localhost:6379/__REDIS_DB__
|
||||
|
||||
DISABLE_USER_REGISTRATION=false
|
||||
|
||||
ACCESS_TOKEN_AGE=5184000
|
||||
REFRESH_TOKEN_AGE=31556926
|
||||
|
||||
EPHEMERAL_SESSION_AGE=259200
|
||||
|
||||
MAX_LOGIN_ATTEMPTS=6
|
||||
FAILED_LOGIN_LOCKOUT=3600
|
||||
|
||||
PSEUDO_KEY_PARAMS_KEY=__PSEUDO_KEY_PARAMS_KEY__
|
||||
|
||||
SNS_TOPIC_ARN=
|
||||
SNS_AWS_REGION=
|
||||
SQS_QUEUE_URL=
|
||||
SQS_AWS_REGION=
|
||||
|
||||
USER_SERVER_REGISTRATION_URL=
|
||||
USER_SERVER_AUTH_KEY=
|
||||
|
||||
SYNCING_SERVER_URL=http://localhost:__PORT_SYNCING_SERVER_JS__
|
||||
|
||||
REDIS_EVENTS_CHANNEL=events
|
||||
|
||||
# (Optional) New Relic Setup
|
||||
NEW_RELIC_ENABLED=false
|
||||
NEW_RELIC_APP_NAME=Auth
|
||||
NEW_RELIC_LICENSE_KEY=
|
||||
NEW_RELIC_NO_CONFIG_FILE=true
|
||||
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
|
||||
NEW_RELIC_LOG_ENABLED=false
|
||||
NEW_RELIC_LOG_LEVEL=info
|
45
conf/env_syncing-server-js-worker.env.sample
Normal file
45
conf/env_syncing-server-js-worker.env.sample
Normal file
|
@ -0,0 +1,45 @@
|
|||
__YNH_NODE_LOAD_PATH__
|
||||
|
||||
LOG_LEVEL="info"
|
||||
NODE_ENV="production"
|
||||
|
||||
AUTH_JWT_SECRET=__AUTH_JWT_SECRET__
|
||||
|
||||
PORT=__PORT_SYNCING_SERVER_JS_WORKER__
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_REPLICA_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_USERNAME=__DB_USER__
|
||||
DB_PASSWORD=__DB_PWD__
|
||||
DB_DATABASE=__DB_NAME__
|
||||
DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"
|
||||
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
||||
|
||||
REDIS_URL=redis://localhost:6379/__REDIS_DB__
|
||||
|
||||
SNS_TOPIC_ARN=
|
||||
SNS_AWS_REGION=
|
||||
SQS_QUEUE_URL=
|
||||
SQS_AWS_REGION=
|
||||
S3_AWS_REGION=
|
||||
S3_BACKUP_BUCKET_NAME=
|
||||
|
||||
REDIS_EVENTS_CHANNEL=events
|
||||
|
||||
INTERNAL_DNS_REROUTE_ENABLED=false
|
||||
#EXTENSIONS_SERVER_URL=http://extensions-server:3004
|
||||
AUTH_SERVER_URL=http://localhost:__PORT_AUTH__
|
||||
|
||||
EMAIL_ATTACHMENT_MAX_BYTE_SIZE=10485760
|
||||
|
||||
REVISIONS_FREQUENCY=300
|
||||
|
||||
# (Optional) New Relic Setup
|
||||
NEW_RELIC_ENABLED=false
|
||||
NEW_RELIC_APP_NAME="Syncing Server JS"
|
||||
NEW_RELIC_LICENSE_KEY=
|
||||
NEW_RELIC_NO_CONFIG_FILE=true
|
||||
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
|
||||
NEW_RELIC_LOG_ENABLED=false
|
||||
NEW_RELIC_LOG_LEVEL=info
|
45
conf/env_syncing-server-js.env.sample
Normal file
45
conf/env_syncing-server-js.env.sample
Normal file
|
@ -0,0 +1,45 @@
|
|||
__YNH_NODE_LOAD_PATH__
|
||||
|
||||
LOG_LEVEL="info"
|
||||
NODE_ENV="production"
|
||||
|
||||
AUTH_JWT_SECRET=__AUTH_JWT_SECRET__
|
||||
|
||||
PORT=__PORT_SYNCING_SERVER_JS__
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_REPLICA_HOST=localhost
|
||||
DB_PORT=3306
|
||||
DB_USERNAME=__DB_USER__
|
||||
DB_PASSWORD=__DB_PWD__
|
||||
DB_DATABASE=__DB_NAME__
|
||||
DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"
|
||||
DB_MIGRATIONS_PATH=dist/migrations/*.js
|
||||
|
||||
REDIS_URL=redis://localhost:6379/__REDIS_DB__
|
||||
|
||||
SNS_TOPIC_ARN=
|
||||
SNS_AWS_REGION=
|
||||
SQS_QUEUE_URL=
|
||||
SQS_AWS_REGION=
|
||||
S3_AWS_REGION=
|
||||
S3_BACKUP_BUCKET_NAME=
|
||||
|
||||
REDIS_EVENTS_CHANNEL=events
|
||||
|
||||
INTERNAL_DNS_REROUTE_ENABLED=false
|
||||
#EXTENSIONS_SERVER_URL=http://extensions-server:3004
|
||||
AUTH_SERVER_URL=http://localhost:__PORT_AUTH__
|
||||
|
||||
EMAIL_ATTACHMENT_MAX_BYTE_SIZE=10485760
|
||||
|
||||
REVISIONS_FREQUENCY=300
|
||||
|
||||
# (Optional) New Relic Setup
|
||||
NEW_RELIC_ENABLED=false
|
||||
NEW_RELIC_APP_NAME="Syncing Server JS"
|
||||
NEW_RELIC_LICENSE_KEY=
|
||||
NEW_RELIC_NO_CONFIG_FILE=true
|
||||
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
|
||||
NEW_RELIC_LOG_ENABLED=false
|
||||
NEW_RELIC_LOG_LEVEL=info
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/action-bar/archive/1.3.1.zip
|
||||
SOURCE_SUM=413F74598DA5C5B401D95620B330E23A094BEEF9DD9C2EBC653199E7FDBB7F7F
|
||||
SOURCE_URL=https://github.com/standardnotes/action-bar/archive/1.3.2.zip
|
||||
SOURCE_SUM=35b03cc5be9b7d948016ca6f7de8e682361a810f884f6e2c0a71cb09100baba0
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/bold-editor/archive/1.1.0.zip
|
||||
SOURCE_SUM=a842181f1e2e0cc93a29ff1c532c4650cbcc3327742267bb3471f1018406df0f
|
||||
SOURCE_URL=https://github.com/standardnotes/bold-editor/archive/1.2.1.zip
|
||||
SOURCE_SUM=7bae5d62d0d49fe199f2a204317e23906e138072db4a8c2569a2479a42d2c357
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/folders-component/archive/1.3.5.zip
|
||||
SOURCE_SUM=190CE79BAD28C772955960A16D6027BE8B7B7A9B8850BD65D79F5FAB4FF64E90
|
||||
SOURCE_URL=https://github.com/standardnotes/folders-component/archive/1.3.8.zip
|
||||
SOURCE_SUM=ae30cf348466af90b05216a16f8094fd9f087979dced6b1b83a8ad5f26a924e3
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/markdown-basic/archive/1.3.7.zip
|
||||
SOURCE_SUM=86DD8CCB0D4EBF2FFDD5D2D925230AC1B6CA4742C4B4729FE8B2A28C44DC6B0A
|
||||
SOURCE_URL=https://github.com/standardnotes/markdown-basic/archive/1.4.0.zip
|
||||
SOURCE_SUM=acfa7ea3974de9441381020c64e343303cbd7d27c30175ed3c047c17c6f98cad
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/markdown-pro/archive/1.3.9.zip
|
||||
SOURCE_SUM=70a21fa13554d4a7a6d3ac5ae06acf4b97a88b6ea5af804e958774273aaf1c40
|
||||
SOURCE_URL=https://github.com/standardnotes/markdown-pro/archive/1.3.14.zip
|
||||
SOURCE_SUM=0fe5d2a062fc780e417979605e779ee17bbe580ecfa936a45d8007d8ca6d3b0e
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/mfa-link/archive/1.2.2.zip
|
||||
SOURCE_SUM=6B41F549FCB8721D429FA216D261C8221C2FC8304EF5C2BF9F98A58C1D7D7388
|
||||
SOURCE_URL=https://github.com/standardnotes/mfa-link/archive/1.2.4.zip
|
||||
SOURCE_SUM=d384b8927eafc009022c15d9488e67f0e11672c7b5c90f2318b4cb15b0c81c6a
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/midnight-theme/archive/1.2.1.zip
|
||||
SOURCE_SUM=f219de3cf26494a73d506139082463a06782a5fc1717290d96da9c8a54102342
|
||||
SOURCE_URL=https://github.com/standardnotes/midnight-theme/archive/1.2.2.zip
|
||||
SOURCE_SUM=916aa7ebbd9df97d2dba0d14b322031307495787ededb4429a295792756b7c2b
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/minimal-markdown-editor/archive/1.3.5.zip
|
||||
SOURCE_SUM=c062db588a500e227524bc0e28335dcfebbd913badd19784e00ab607bec7abbf
|
||||
SOURCE_URL=https://github.com/standardnotes/minimal-markdown-editor/archive/1.3.7.zip
|
||||
SOURCE_SUM=58232eeb4a129c1c89dbc86271832d68ff3c508e2256e80b099a18e95258cd70
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/plus-editor/archive/1.4.5.zip
|
||||
SOURCE_SUM=9F4C4381D66FDE8C8867EDA36C3802616758D2185A4EBB5E903CF296004C6C53
|
||||
SOURCE_URL=https://github.com/standardnotes/plus-editor/archive/1.5.0.zip
|
||||
SOURCE_SUM=2d30a2544523f9d482f17a0bdace0b7e803a40c96ccd320926776a403ec6cd6f
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/simple-task-editor/archive/1.3.5.zip
|
||||
SOURCE_SUM=2cb836e9932a8e39b41397fc6f9ef721c894e422a3f898db66cb340d9cbf931b
|
||||
SOURCE_URL=https://github.com/standardnotes/simple-task-editor/archive/1.3.7.zip
|
||||
SOURCE_SUM=11afda3335058031880b7f1833d639f37b32d92c5b1ad8359503af2784706215
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/standardnotes/token-vault/archive/1.0.5.zip
|
||||
SOURCE_SUM=a9f4e1bafec6194499dd163fd53bdb9876689c99e7218b36a8e26dbe0c096f21
|
||||
SOURCE_URL=https://github.com/standardnotes/token-vault/archive/1.0.10.zip
|
||||
SOURCE_SUM=e078f096717ae03a50634d2267cea457deb49ced30e1741cd2ba28829aa1b947
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,17 +1,61 @@
|
|||
location __PATH__/ {
|
||||
alias __FINALPATH__/live/public ;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
proxy_pass http://127.0.0.1:__PORT____PATH__/;
|
||||
proxy_pass http://127.0.0.1:__PORT_API_GATEWAY__/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_buffering off;
|
||||
|
||||
more_set_headers "Content-Security-Policy: frame-ancestors 'self' __ACCESS_DOMAIN__";
|
||||
}
|
||||
|
||||
location = __PATH__/ {
|
||||
default_type text/plain;
|
||||
return 200 "This is where Standard Notes - Syncing Server is installed.";
|
||||
}
|
||||
|
||||
location __PATH__/help/ {
|
||||
alias __FINAL_PATH_WWW__/help/;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
location = __PATH__/extensions {
|
||||
return 301 https://$server_name__PATH__/extensions/repo.json;
|
||||
}
|
||||
|
||||
location = __PATH__/extensions/ {
|
||||
|
||||
return 301 https://$server_name__PATH__/extensions/repo.json;
|
||||
}
|
||||
|
||||
location __PATH__/extensions/ {
|
||||
alias __FINAL_PATH_EXTENSIONS__/;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
if ($request_method = 'OPTIONS') {
|
||||
more_set_headers 'Access-Control-Allow-Origin: $http_origin';
|
||||
more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, HEAD';
|
||||
more_set_headers 'Access-Control-Allow-Credentials: true';
|
||||
more_set_headers 'Access-Control-Allow-Headers: Origin,Content-Type,Accept,Authorization';
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
more_set_headers 'Access-Control-Allow-Origin: $http_origin';
|
||||
more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, HEAD';
|
||||
more_set_headers 'Access-Control-Allow-Credentials: true';
|
||||
more_set_headers 'Access-Control-Allow-Headers: Origin,Content-Type,Accept,Authorization';
|
||||
}
|
||||
more_set_headers "Content-Security-Policy: frame-ancestors 'self' * ";
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
[Unit]
|
||||
Description=__APP__ service
|
||||
After=network.target
|
||||
After=mysql.service
|
||||
After=redis.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live
|
||||
Environment="RAILS_ENV=production"
|
||||
Environment="PORT=__PORT__"
|
||||
ExecStart=__RBENV_INSTALL_DIR__/versions/__APP__/bin/bundle exec rails server
|
||||
ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=append:/var/log/__APP__/__APP__.log
|
||||
SyslogIdentifier=__APP__
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
46
conf/systemd_api-gateway.service
Normal file
46
conf/systemd_api-gateway.service
Normal file
|
@ -0,0 +1,46 @@
|
|||
[Unit]
|
||||
Description=StandardNotes api-gateway
|
||||
After=network.target
|
||||
After=__APP__-syncing-server-js.service
|
||||
After=__APP__-auth.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live/api-gateway
|
||||
EnvironmentFile=__FINALPATH__/live/api-gateway.env
|
||||
ExecStart=/usr/bin/yarn start
|
||||
StandardOutput=append:/var/log/__APP__/api-gateway.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
DevicePolicy=closed
|
||||
ProtectSystem=full
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
LockPersonality=yes
|
||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||
|
||||
# Denying access to capabilities that should not be relevant for webapps
|
||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
47
conf/systemd_auth-worker.service
Normal file
47
conf/systemd_auth-worker.service
Normal file
|
@ -0,0 +1,47 @@
|
|||
[Unit]
|
||||
Description=StandardNotes auth worker
|
||||
After=network.target
|
||||
After=mysql.service
|
||||
After=redis.service
|
||||
After=__APP__-auth.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live/auth
|
||||
EnvironmentFile=__FINALPATH__/live/auth-worker.env
|
||||
ExecStart=/usr/bin/yarn worker
|
||||
StandardOutput=append:/var/log/__APP__/auth-worker.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
DevicePolicy=closed
|
||||
ProtectSystem=full
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
LockPersonality=yes
|
||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||
|
||||
# Denying access to capabilities that should not be relevant for webapps
|
||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
47
conf/systemd_auth.service
Normal file
47
conf/systemd_auth.service
Normal file
|
@ -0,0 +1,47 @@
|
|||
[Unit]
|
||||
Description=StandardNotes auth
|
||||
After=network.target
|
||||
After=mysql.service
|
||||
After=redis.service
|
||||
After=__APP__-syncing-server-js.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live/auth
|
||||
EnvironmentFile=__FINALPATH__/live/auth.env
|
||||
ExecStart=/usr/bin/yarn start
|
||||
StandardOutput=append:/var/log/__APP__/auth.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
DevicePolicy=closed
|
||||
ProtectSystem=full
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
LockPersonality=yes
|
||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||
|
||||
# Denying access to capabilities that should not be relevant for webapps
|
||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
47
conf/systemd_syncing-server-js-worker.service
Normal file
47
conf/systemd_syncing-server-js-worker.service
Normal file
|
@ -0,0 +1,47 @@
|
|||
[Unit]
|
||||
Description=StandardNotes syncing server worker
|
||||
After=network.target
|
||||
After=mysql.service
|
||||
After=redis.service
|
||||
After=__APP__-syncing-server-js.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live/syncing-server-js
|
||||
EnvironmentFile=__FINALPATH__/live/syncing-server-js-worker.env
|
||||
ExecStart=/usr/bin/yarn worker
|
||||
StandardOutput=append:/var/log/__APP__/syncing-server-js-worker.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
DevicePolicy=closed
|
||||
ProtectSystem=full
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
LockPersonality=yes
|
||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||
|
||||
# Denying access to capabilities that should not be relevant for webapps
|
||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
46
conf/systemd_syncing-server-js.service
Normal file
46
conf/systemd_syncing-server-js.service
Normal file
|
@ -0,0 +1,46 @@
|
|||
[Unit]
|
||||
Description=StandardNotes syncing server
|
||||
After=network.target
|
||||
After=mysql.service
|
||||
After=redis.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/live/syncing-server-js
|
||||
EnvironmentFile=__FINALPATH__/live/syncing-server-js.env
|
||||
ExecStart=/usr/bin/yarn start
|
||||
StandardOutput=append:/var/log/__APP__/syncing-server-js.log
|
||||
StandardError=inherit
|
||||
Restart=always
|
||||
|
||||
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||
NoNewPrivileges=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
||||
RestrictNamespaces=yes
|
||||
RestrictRealtime=yes
|
||||
DevicePolicy=closed
|
||||
ProtectSystem=full
|
||||
ProtectControlGroups=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectKernelTunables=yes
|
||||
LockPersonality=yes
|
||||
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
||||
|
||||
# Denying access to capabilities that should not be relevant for webapps
|
||||
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
||||
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
||||
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
||||
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
||||
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
||||
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
||||
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
||||
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
||||
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
||||
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
|
@ -1,14 +0,0 @@
|
|||
version = "1.0"
|
||||
name = "SNServer configuration panel"
|
||||
|
||||
[main]
|
||||
name = "SNserver configuration"
|
||||
|
||||
[main.access_domain]
|
||||
name = "Access Domain"
|
||||
|
||||
[main.access_domain.access_domain]
|
||||
ask = "Which web app can access the Standart Notes Extensions?"
|
||||
type = "string"
|
||||
default = ""
|
||||
help = "Please enter the domain(s) without the path of a Standart Notes Web App, which should have access to the Standard Notes Extensions.<br>Example: domain.tld<br>Example: https://domain.tld<br>Example: domain.tld notes.domain.tld<br>Example: domain.tld https://notes.domain.tld"
|
|
@ -1,10 +1,9 @@
|
|||
* Any known limitations, constrains or stuff not working, such as (but not limited to):
|
||||
* No single-sign on or LDAP integration
|
||||
* The app requires up 600MB of RAM to install
|
||||
* The app requires at least 110MB of RAM to work properly. And will increase with use.
|
||||
* The app requires around 300MB of disk.
|
||||
* The app requires at least 450MB of RAM to work properly.
|
||||
* The app requires at least 650MB of RAM to start.
|
||||
* The app requires around 1800MB of disk.
|
||||
|
||||
* Other infos that people should be aware of, such as:
|
||||
* The config-file is stored under "/opt/yunohost/$app/live/.env"
|
||||
* You can find additional config features under https://your-domain.tld/yunohost/admin/#/apps/$app/config-panel
|
||||
* The ".env" config-files are stored under "/opt/yunohost/$app/live/"
|
||||
* You can change the url of this app, but than all useres have to reinstall the extensions.
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
"description": {
|
||||
"en": "The Standard Notes syncing server. An end-to-end encrypted note-taking app."
|
||||
},
|
||||
"version": "3.22.8~ynh2",
|
||||
"url": "https://github.com/standardnotes/syncing-server",
|
||||
"version": "2021.07.06~ynh1",
|
||||
"url": "https://github.com/standardnotes/standalone",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"website": "https://standardnotes.org/",
|
||||
"demo": "https://standardnotes.org/demo",
|
||||
"admindoc": "https://docs.standardnotes.org/",
|
||||
"userdoc": "https://docs.standardnotes.org/",
|
||||
"code": "https://github.com/standardnotes/syncing-server"
|
||||
"userdoc": "https://standardnotes.com/help",
|
||||
"code": "https://github.com/standardnotes/standalone"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
@ -40,24 +40,6 @@
|
|||
"type": "path",
|
||||
"example": "/example",
|
||||
"default": "/example"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "The Standard Notes - Syncing Server should be public accessable if you want to connect with a desktop or mobile app."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "access_domain",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose a domain which has access to the extensions. E.g. the Standard-Notes web app."
|
||||
},
|
||||
"optional": true,
|
||||
"example": "example.tld",
|
||||
"default": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4,32 +4,21 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
RUBY_VERSION="2.7.3"
|
||||
NODEJS_VERSION="15.11.0"
|
||||
|
||||
syncing_server_js_version="1.35.2"
|
||||
auth_version="1.11.1"
|
||||
api_gateway_version="1.20.0"
|
||||
extensions_version="2021.07.06"
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="\
|
||||
zlib1g-dev \
|
||||
libsqlite3-dev \
|
||||
default-libmysqlclient-dev \
|
||||
libssl-dev \
|
||||
libreadline-dev \
|
||||
libjemalloc-dev"
|
||||
pkg_dependencies=""
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Check if service is ready
|
||||
is_service_ready() {
|
||||
for ((i = 0 ; i < 15 ; i++))
|
||||
do
|
||||
if [ "200" -eq $(curl --silent --insecure --resolve $domain:443:127.0.0.1 https://$domain$path_url/ -o /dev/null --write-out "%{http_code}") ]
|
||||
then
|
||||
break
|
||||
else
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
|
|
|
@ -29,6 +29,7 @@ ynh_print_info "Loading installation settings..."
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
|
@ -38,6 +39,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
ynh_print_info "Backing up the main app directory..."
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="$final_path_www"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
@ -75,7 +77,11 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
ynh_print_info "Backing up systemd configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-syncing-server-js.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-syncing-server-js-worker.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-auth.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-auth-worker.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-api-gateway.service"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -29,15 +29,13 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
|
||||
access_domain=$(echo $access_domain | sed "s@;@ @g")
|
||||
mail=$(ynh_app_setting_get --app=$app --key=mail)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
||||
final_path_extensions=$(ynh_app_setting_get --app=$app --key=final_path_extensions)
|
||||
port_syncing_server_js=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js)
|
||||
port_syncing_server_js_worker=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js_worker)
|
||||
port_auth=$(ynh_app_setting_get --app=$app --key=port_auth)
|
||||
port_auth_worker=$(ynh_app_setting_get --app=$app --key=port_auth_worker)
|
||||
port_api_gateway=$(ynh_app_setting_get --app=$app --key=port_api_gateway)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
|
@ -75,12 +73,6 @@ fi
|
|||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
|
@ -113,18 +105,6 @@ fi
|
|||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||
|
||||
config_file="$final_path/live/.env"
|
||||
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=$old_path" --replace_string="RAILS_RELATIVE_URL_ROOT=$new_path" --target_file="$config_file"
|
||||
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
new_mail="$app@$new_domain"
|
||||
ynh_replace_string --match_string="$mail" --replace_string="$new_mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"
|
||||
fi
|
||||
ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_domain$new_path" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
|
||||
|
||||
#=================================================
|
||||
# Modify Standard Notes - Extensions
|
||||
#=================================================
|
||||
|
@ -137,9 +117,17 @@ else
|
|||
path=$new_path
|
||||
fi
|
||||
|
||||
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
ynh_replace_string \
|
||||
--match_string='url": "https://.*/extensions/src/' \
|
||||
--replace_string='url": "https://'$domain$path'/extensions/src/' \
|
||||
--target_file="$final_path_extensions/repo.json"
|
||||
|
||||
find "$final_path_extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
do
|
||||
ynh_replace_string --match_string='"url": "https://.*/extensions/src/' --replace_string='"url": "https://$domain$path/extensions/src/' --target_file="$file"
|
||||
ynh_replace_string \
|
||||
--match_string='url": "https://.*/extensions/src/' \
|
||||
--replace_string='url": "https://'$domain$path'extensions/src/' \
|
||||
--target_file="$file"
|
||||
done
|
||||
|
||||
#=================================================
|
||||
|
@ -156,12 +144,6 @@ ynh_add_fail2ban_config --use_template
|
|||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
@ -169,13 +151,6 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# WAITING FOR SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Waiting for service..." --weight=1
|
||||
|
||||
is_service_ready
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
@ -188,7 +163,7 @@ admin_mail_info="You changed the url of the server. All Extensions have to be re
|
|||
|
||||
echo -e "\
|
||||
Standard Notes - Syncing Server's url was successfully changed.\n\
|
||||
Please configure the Standard Notes web app or mobile app to use this syning server: https://$domain$path_url/\n\
|
||||
Please configure the Standard Notes web app or mobile app to use this syncing server: https://$domain$path_url/\n\
|
||||
$config_panel\n\n\
|
||||
$admin_mail_info\
|
||||
" > message
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ./_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
|
||||
#=================================================
|
||||
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
|
||||
#=================================================
|
||||
|
||||
show_config() {
|
||||
if [ ! -z $access_domain ]
|
||||
then
|
||||
ynh_return "YNH_CONFIG_MAIN_ACCESS_DOMAIN_ACCESS_DOMAIN=$(echo $access_domain | sed "s@;@ @g")"
|
||||
else
|
||||
ynh_return "YNH_CONFIG_MAIN_ACCESS_DOMAIN_ACCESS_DOMAIN=$domain"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# MODIFY THE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
apply_config() {
|
||||
access_domain=${YNH_CONFIG_MAIN_ACCESS_DOMAIN_ACCESS_DOMAIN:-$access_domain}
|
||||
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
|
||||
|
||||
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
|
||||
access_domains=$(echo $access_domain | sed "s@;@ @g")
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
ynh_delete_file_checksum --file=$nginx_conf_path
|
||||
ynh_replace_string \
|
||||
--match_string='more_set_headers "Content-Security-Policy: frame-ancestors '"'self'"'.*";' \
|
||||
--replace_string='more_set_headers "Content-Security-Policy: frame-ancestors '"'self' $access_domains"'";' \
|
||||
--target_file=$nginx_conf_path
|
||||
ynh_store_file_checksum --file=$nginx_conf_path
|
||||
|
||||
systemctl reload nginx
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
|
||||
#=================================================
|
||||
case $1 in
|
||||
show) show_config;;
|
||||
apply) apply_config;;
|
||||
esac
|
308
scripts/install
308
scripts/install
|
@ -28,21 +28,19 @@ ynh_abort_if_errors
|
|||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
access_domain=$YNH_APP_ARG_ACCESS_DOMAIN
|
||||
if [ -z "$access_domain" ]
|
||||
then
|
||||
access_domain=$domain
|
||||
fi
|
||||
access_domain=$(echo $access_domain | sed "s@;@ @g")
|
||||
mail="$app@$domain"
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
final_path=/opt/yunohost/$app
|
||||
final_path_www=/var/www/$app
|
||||
final_path_extensions="$final_path_www/extensions"
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
ynh_app_setting_set --app=$app --key=final_path_www --value=$final_path_www
|
||||
ynh_app_setting_set --app=$app --key=final_path_extensions --value=$final_path_extensions
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
test ! -e "$final_path_www" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
@ -54,11 +52,18 @@ ynh_script_progression --message="Storing installation settings..." --weight=3
|
|||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
|
||||
ynh_app_setting_set --app=$app --key=mail --value=$mail
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS
|
||||
#=================================================
|
||||
ynh_app_setting_set --app=$app --key=syncing_server_js_version --value=$syncing_server_js_version
|
||||
ynh_app_setting_set --app=$app --key=auth_version --value=$auth_version
|
||||
ynh_app_setting_set --app=$app --key=api_gateway_version --value=$api_gateway_version
|
||||
ynh_app_setting_set --app=$app --key=extensions_version --value=$extensions_version
|
||||
ynh_app_setting_set --app=$app --key=standalone --value="true"
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
|
@ -67,9 +72,16 @@ ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
|||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=3000)
|
||||
# Open the port
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
port_syncing_server_js=$(ynh_find_port --port=3000)
|
||||
port_syncing_server_js_worker=$(ynh_find_port --port=$((port_syncing_server_js+1)))
|
||||
port_auth=$(ynh_find_port --port=$((port_syncing_server_js_worker+1)))
|
||||
port_auth_worker=$(ynh_find_port --port=$((port_auth+1)))
|
||||
port_api_gateway=$(ynh_find_port --port=$((port_auth_worker+1)))
|
||||
ynh_app_setting_set --app=$app --key=port_syncing_server_js --value=$port_syncing_server_js
|
||||
ynh_app_setting_set --app=$app --key=port_syncing_server_js_worker --value=$port_syncing_server_js_worker
|
||||
ynh_app_setting_set --app=$app --key=port_auth --value=$port_auth
|
||||
ynh_app_setting_set --app=$app --key=port_auth_worker --value=$port_auth_worker
|
||||
ynh_app_setting_set --app=$app --key=port_api_gateway --value=$port_api_gateway
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
|
@ -77,7 +89,16 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
ynh_script_progression --message="Installing dependencies..." --weight=17
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -94,10 +115,41 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=2
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p $final_path
|
||||
ynh_setup_source --dest_dir="$final_path/live"
|
||||
mkdir -p "$final_path/live"
|
||||
ynh_setup_source --source_id=app_syncing-server-js --dest_dir="$final_path/live/syncing-server-js"
|
||||
ynh_setup_source --source_id=app_syncing-server-js --dest_dir="$final_path/live/syncing-server-js-worker"
|
||||
ynh_setup_source --source_id=app_auth --dest_dir="$final_path/live/auth"
|
||||
ynh_setup_source --source_id=app_auth --dest_dir="$final_path/live/auth-worker"
|
||||
ynh_setup_source --source_id=app_api-gateway --dest_dir="$final_path/live/api-gateway"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
# Copy help file
|
||||
mkdir -p "$final_path_www/help"
|
||||
if test -e "$YNH_APP_BASEDIR/sources/extra_files/help"; then
|
||||
cp --archive "$YNH_APP_BASEDIR/sources/extra_files/help/." "$final_path_www/help"
|
||||
fi
|
||||
ynh_replace_vars --file="$final_path_www/help/index.html"
|
||||
|
||||
# Extensions
|
||||
mkdir -p "$final_path_extensions"
|
||||
|
||||
if test -e "$YNH_APP_BASEDIR/sources/extra_files/extensions"; then
|
||||
cp --archive "$YNH_APP_BASEDIR/sources/extra_files/extensions/." "$final_path_extensions"
|
||||
fi
|
||||
|
||||
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||
do
|
||||
basename=$(basename -as .src $file)
|
||||
ynh_setup_source --dest_dir="$final_path_extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||
done
|
||||
|
||||
chmod 750 "$final_path_www"
|
||||
chmod -R o-rwx "$final_path_www"
|
||||
chown -R "www-data":"www-data" "$final_path_www"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -107,78 +159,64 @@ ynh_script_progression --message="Configuring nginx web server..." --weight=3
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# INSTALLING RUBY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Ruby...( This may take a while... )" --weight=100 #331
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_use_ruby
|
||||
ynh_gem update --system --no-document
|
||||
ynh_gem install bundler --no-document
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# Setup
|
||||
#=================================================
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..." --weight=2
|
||||
|
||||
config_file="$final_path/live/.env"
|
||||
cp -f ../conf/env.sample $config_file
|
||||
ynh_replace_string --match_string="EXPOSED_PORT=.*$" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file"
|
||||
secret_key=$(ynh_string_random --length=48 | base64)
|
||||
ynh_replace_string --match_string="SECRET_KEY_BASE=.*$" --replace_string="SECRET_KEY_BASE=$secret_key" --target_file="$config_file"
|
||||
pseudo_key=$(ynh_string_random --length=48 | base64)
|
||||
ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=.*$" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="RAILS_ENV=.*$" --replace_string="RAILS_ENV=production" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="DB_DATABASE=.*$" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="DB_USERNAME=.*$" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="DB_PASSWORD=.*$" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=.*$" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_STARTTLS=.*$" --replace_string="SMTP_STARTTLS=" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_file"
|
||||
config_syncing_server_js="$final_path/live/syncing-server-js.env"
|
||||
config_syncing_server_js_worker="$final_path/live/syncing-server-js-worker.env"
|
||||
config_auth="$final_path/live/auth.env"
|
||||
config_auth_worker="$final_path/live/auth-worker.env"
|
||||
config_api_gateway="$final_path/live/api-gateway.env"
|
||||
|
||||
ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
|
||||
jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||
legacy_jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||
auth_jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||
pseudo_key_params_key=$(ynh_string_random --length=48 | base64)
|
||||
encryption_server_key=$(hexdump -n 32 -e '4/4 "%08X"' /dev/random) # 32bytes hex key is required
|
||||
|
||||
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
|
||||
ynh_app_setting_set --app=$app --key=legacy_jwt_secret --value=$legacy_jwt_secret
|
||||
ynh_app_setting_set --app=$app --key=auth_jwt_secret --value=$auth_jwt_secret
|
||||
ynh_app_setting_set --app=$app --key=pseudo_key_params_key --value=$pseudo_key_params_key
|
||||
ynh_app_setting_set --app=$app --key=encryption_server_key --value=$encryption_server_key
|
||||
|
||||
ynh_add_config --template="env_syncing-server-js.env.sample" --destination="$config_syncing_server_js"
|
||||
ynh_add_config --template="env_syncing-server-js-worker.env.sample" --destination="$config_syncing_server_js_worker"
|
||||
ynh_add_config --template="env_auth.env.sample" --destination="$config_auth"
|
||||
ynh_add_config --template="env_auth-worker.env.sample" --destination="$config_auth_worker"
|
||||
ynh_add_config --template="env_api-gateway.env.sample" --destination="$config_api_gateway"
|
||||
|
||||
#=================================================
|
||||
# INSTALLING Standard Notes - Syncing Server
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Standard Notes - Syncing Server..." --weight=93
|
||||
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle'
|
||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set with 'development'
|
||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||
ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate --quiet
|
||||
ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:seed --quiet
|
||||
# ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet
|
||||
ynh_use_nodejs
|
||||
pushd "$final_path/live/syncing-server-js"
|
||||
ynh_print_info "Installing ... [1/3]"
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||
popd
|
||||
pushd "$final_path/live/auth"
|
||||
ynh_print_info "Installing ... [2/3]"
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||
popd
|
||||
pushd "$final_path/live/api-gateway"
|
||||
ynh_print_info "Installing ... [3/3]"
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# INSTALLING Standard Notes - Extensions
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
||||
ynh_script_progression --message="Setup Standard Notes - Extensions..." --weight=1
|
||||
|
||||
|
||||
if [ $path_url = "/" ]
|
||||
|
@ -188,18 +226,13 @@ else
|
|||
path=$path_url
|
||||
fi
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path_extensions/repo.json"
|
||||
|
||||
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
find "$final_path_extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
do
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
||||
done
|
||||
|
||||
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||
do
|
||||
basename=$(basename -as .src $file)
|
||||
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -207,7 +240,11 @@ done
|
|||
ynh_script_progression --message="Configuring a systemd service..." --weight=4
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config --service="$app-syncing-server-js" --template="systemd_syncing-server-js.service"
|
||||
ynh_add_systemd_config --service="$app-syncing-server-js-worker" --template="systemd_syncing-server-js-worker.service"
|
||||
ynh_add_systemd_config --service="$app-auth" --template="systemd_auth.service"
|
||||
ynh_add_systemd_config --service="$app-auth-worker" --template="systemd_auth-worker.service"
|
||||
ynh_add_systemd_config --service="$app-api-gateway" --template="systemd_api-gateway.service"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
|
@ -215,67 +252,42 @@ ynh_add_systemd_config
|
|||
ynh_script_progression --message="Storing the config file checksum..." --weight=1
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$config_file"
|
||||
ynh_store_file_checksum --file="$config_syncing_server_js"
|
||||
ynh_store_file_checksum --file="$config_syncing_server_js_worker"
|
||||
ynh_store_file_checksum --file="$config_auth"
|
||||
ynh_store_file_checksum --file="$config_auth_worker"
|
||||
ynh_store_file_checksum --file="$config_api_gateway"
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Securing files and directories..." --weight=1
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
mkdir -p "$final_path/live/log"
|
||||
chown -R $app: "$final_path/live/log/"
|
||||
mkdir -p "$final_path/live/tmp"
|
||||
chown -R $app: "$final_path/live/tmp/"
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app: "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R "$app": "/var/log/$app"
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --logfile="$final_path/live/log/production.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/$app.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/syncing-server.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/syncing-server-worker.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/auth.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/auth-worker.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/api-gateway.log"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrate $app service in Yunohost..." --weight=1
|
||||
|
||||
yunohost service add $app --description "Standard Notes - Syncing Server" --log "/var/log/$app/$app.log"
|
||||
yunohost service add "$app-syncing-server-js" --description="Standard Notes - Syncing Server" --log="/var/log/$app/syncing-server-js.log"
|
||||
yunohost service add "$app-syncing-server-js-worker" --description="Standard Notes - Syncing Server - Worker" --log="/var/log/$app/syncing-server-js-worker.log"
|
||||
yunohost service add "$app-auth" --description="Standard Notes - Auth" --log="/var/log/$app/auth.log"
|
||||
yunohost service add "$app-auth-worker" --description="Standard Notes - Auth - Worker" --log="/var/log/$app/auth-worker.log"
|
||||
yunohost service add "$app-api-gateway" --description="Standard Notes - API Gateway" --log="/var/log/$app/api-gateway.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring fail2ban..." --weight=1
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
touch "/var/log/$app/$app.log"
|
||||
ynh_add_fail2ban_config --use_template
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=3
|
||||
|
||||
# Make app public if necessary
|
||||
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" --remove="all_users"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -283,7 +295,49 @@ fi
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/syncing-server-js.log" \
|
||||
--line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js-worker" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/syncing-server-js-worker.log" \
|
||||
--line_match='{"message":"Starting worker...","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/auth.log" \
|
||||
--line_match='{"message":"Server started on port '$port_auth'","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth-worker" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/auth-worker.log" \
|
||||
--line_match='{"message":"Starting worker...","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-api-gateway" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/api-gateway.log" \
|
||||
--line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}'
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring fail2ban..." --weight=1
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --use_template
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=3
|
||||
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors" --show_tile="false"
|
||||
ynh_permission_create --permission="help" --url="/help/" --allowed="all_users" --show_tile="true" --label="Help"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
@ -292,13 +346,6 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# WAITING FOR SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Waiting for service..." --weight=1
|
||||
|
||||
is_service_ready
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
@ -309,15 +356,12 @@ config_panel="You can find some specific configurations for this app by using th
|
|||
|
||||
admin_mail_info="\
|
||||
Standard Notes extensions are hosted with this package.\n\
|
||||
New users will get an e-mail with install instructions.\n\
|
||||
With the current SMTP settings you can not send e-mails to all e-mail providers. For example GMail will probably not recive this e-mails.\n\
|
||||
Please setup the SMTP account in this file: \"$final_path/live/.env\" under \"#Mailer settings\" if you want to fix this.\n\
|
||||
Please setup the Access-Domain for the extensions in the __URL_TAG1__config-panel__URL_TAG2__$admin_panel/config-panel__URL_TAG3__ if not already done during the installation settings.\
|
||||
"
|
||||
|
||||
echo -e "\
|
||||
Standard Notes - Syncing Server was successfully installed.\n\
|
||||
Please configure the Standard Notes web app or mobile app to use this syning server: https://$domain$path_url/\n\
|
||||
Please configure the Standard Notes web app or mobile app to use this syncing server: https://$domain$path_url/\n\
|
||||
$config_panel\n\n\
|
||||
$admin_mail_info\
|
||||
" > message
|
||||
|
|
|
@ -19,10 +19,15 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
port_syncing_server_js=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js)
|
||||
port_syncing_server_js_worker=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js_worker)
|
||||
port_auth=$(ynh_app_setting_get --app=$app --key=port_auth)
|
||||
port_auth_worker=$(ynh_app_setting_get --app=$app --key=port_auth_worker)
|
||||
port_api_gateway=$(ynh_app_setting_get --app=$app --key=port_api_gateway)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -34,7 +39,11 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service..." --weight=1
|
||||
yunohost service remove $app
|
||||
yunohost service remove "$app-syncing-server-js"
|
||||
yunohost service remove "$app-syncing-server-js-worker"
|
||||
yunohost service remove "$app-auth"
|
||||
yunohost service remove "$app-auth-worker"
|
||||
yunohost service remove "$app-api-gateway"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -43,7 +52,11 @@ fi
|
|||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config --service="$app"
|
||||
ynh_remove_systemd_config --service="$app-syncing-server-js"
|
||||
ynh_remove_systemd_config --service="$app-syncing-server-js-worker"
|
||||
ynh_remove_systemd_config --service="$app-auth"
|
||||
ynh_remove_systemd_config --service="$app-auth-worker"
|
||||
ynh_remove_systemd_config --service="$app-api-gateway"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
|
@ -66,8 +79,8 @@ ynh_redis_remove_db
|
|||
ynh_script_progression --message="Removing dependencies..." --weight=10
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_ruby
|
||||
ynh_remove_app_dependencies
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
@ -76,6 +89,7 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
|
|||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="$final_path_www"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
|
@ -94,16 +108,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight
|
|||
ynh_remove_logrotate
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
|
|
135
scripts/restore
135
scripts/restore
|
@ -33,6 +33,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
@ -40,20 +41,40 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
|||
redis_db=$(ynh_redis_get_free_db)
|
||||
ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
||||
|
||||
config_file="$final_path/live/.env"
|
||||
config_syncing_server_js="$final_path/live/syncing-server-js.env"
|
||||
config_syncing_server_js_worker="$final_path/live/syncing-server-js-worker.env"
|
||||
config_auth="$final_path/live/auth.env"
|
||||
config_auth_worker="$final_path/live/auth-worker.env"
|
||||
config_api_gateway="$final_path/live/api-gateway.env"
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=2
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url || ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path_www || ynh_die --message="There is already a directory: $final_path_www "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port_syncing_server_js=$(ynh_find_port --port=3000)
|
||||
port_syncing_server_js_worker=$(ynh_find_port --port=$((port_syncing_server_js+1)))
|
||||
port_auth=$(ynh_find_port --port=$((port_syncing_server_js_worker+1)))
|
||||
port_auth_worker=$(ynh_find_port --port=$((port_auth+1)))
|
||||
port_api_gateway=$(ynh_find_port --port=$((port_auth_worker+1)))
|
||||
ynh_app_setting_set --app=$app --key=port_syncing_server_js --value=$port_syncing_server_js
|
||||
ynh_app_setting_set --app=$app --key=port_syncing_server_js_worker --value=$port_syncing_server_js_worker
|
||||
ynh_app_setting_set --app=$app --key=port_auth --value=$port_auth
|
||||
ynh_app_setting_set --app=$app --key=port_auth_worker --value=$port_auth_worker
|
||||
ynh_app_setting_set --app=$app --key=port_api_gateway --value=$port_api_gateway
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -66,6 +87,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$final_path_www"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
|
@ -82,12 +104,11 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
# Restore permissions on app files
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
mkdir -p "$final_path/live/log"
|
||||
chown -R $app: "$final_path/live/log/"
|
||||
mkdir -p "$final_path/live/tmp"
|
||||
chown -R $app: "$final_path/live/tmp/"
|
||||
chmod 750 "$final_path_www"
|
||||
chmod -R o-rwx "$final_path_www"
|
||||
chown -R "www-data":"www-data" "$final_path_www"
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app: "/var/log/$app"
|
||||
|
@ -101,18 +122,8 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=17
|
|||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||
|
||||
#=================================================
|
||||
# INSTALLING RUBY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Ruby...( This may take a while... )" --weight=100 #331
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_use_ruby
|
||||
ynh_gem update --system --no-document
|
||||
ynh_gem install bundler --no-document
|
||||
popd
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
@ -123,33 +134,91 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# SETUP REDIS DATABASE
|
||||
# MODIFY CONFIG
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setup Redis database..." --weight=2
|
||||
ynh_script_progression --message="Modify config files..." --weight=2
|
||||
|
||||
# Redis Port
|
||||
ynh_replace_string --match_string="^REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_syncing_server_js"
|
||||
ynh_replace_string --match_string="^REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_syncing_server_js_worker"
|
||||
ynh_replace_string --match_string="^REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_auth"
|
||||
ynh_replace_string --match_string="^REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_auth_worker"
|
||||
# Syncing_Server_JS Port
|
||||
ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_syncing_server_js" --target_file="$config_syncing_server_js"
|
||||
ynh_replace_string --match_string="^SYNCING_SERVER_URL.*$" --replace_string="SYNCING_SERVER_URL=$port_syncing_server_js" --target_file="$config_auth"
|
||||
ynh_replace_string --match_string="^SYNCING_SERVER_URL.*$" --replace_string="SYNCING_SERVER_URL=$port_syncing_server_js" --target_file="$config_auth_worker"
|
||||
ynh_replace_string --match_string="^SYNCING_SERVER_URL.*$" --replace_string="SYNCING_SERVER_URL=$port_syncing_server_js" --target_file="$config_api_gateway"
|
||||
# Syncing_Server_JS_Worker Port
|
||||
ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_syncing_server_js_worker" --target_file="$config_syncing_server_js_worker"
|
||||
# Auth Port
|
||||
ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_auth" --target_file="$config_auth"
|
||||
ynh_replace_string --match_string="^AUTH_SERVER_URL.*$" --replace_string="AUTH_SERVER_URL=$port_auth" --target_file="$config_syncing_server_js"
|
||||
ynh_replace_string --match_string="^AUTH_SERVER_URL.*$" --replace_string="AUTH_SERVER_URL=$port_auth" --target_file="$config_syncing_server_js_worker"
|
||||
ynh_replace_string --match_string="^AUTH_SERVER_URL.*$" --replace_string="AUTH_SERVER_URL=$port_auth" --target_file="$config_api_gateway"
|
||||
# Auth_Worker Port
|
||||
ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_auth_worker" --target_file="$config_auth_worker"
|
||||
# API-Gateway Port
|
||||
ynh_replace_string --match_string="^PORT.*$" --replace_string="PORT=$port_api_gateway" --target_file="$config_api_gateway"
|
||||
|
||||
|
||||
ynh_replace_string --match_string=".*REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_file"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-syncing-server-js.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-syncing-server-js-worker.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-auth.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-auth-worker.service"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-api-gateway.service"
|
||||
systemctl enable $app-syncing-server-js.service --quiet
|
||||
systemctl enable $app-syncing-server-js-worker.service --quiet
|
||||
systemctl enable $app-auth.service --quiet
|
||||
systemctl enable $app-auth-worker.service --quiet
|
||||
systemctl enable $app-api-gateway.service --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrate $app service in Yunohost..." --weight=1
|
||||
|
||||
yunohost service add $app --description "Standard Notes - Syncing Server" --log "/var/log/$app/$app.log"
|
||||
yunohost service add "$app-syncing-server-js" --description="Standard Notes - Syncing Server" --log="/var/log/$app/syncing-server-js.log"
|
||||
yunohost service add "$app-syncing-server-js-worker" --description="Standard Notes - Syncing Server - Worker" --log="/var/log/$app/syncing-server-js-worker.log"
|
||||
yunohost service add "$app-auth" --description="Standard Notes - Auth" --log="/var/log/$app/auth.log"
|
||||
yunohost service add "$app-auth-worker" --description="Standard Notes - Auth - Worker" --log="/var/log/$app/auth-worker.log"
|
||||
yunohost service add "$app-api-gateway" --description="Standard Notes - API Gateway" --log="/var/log/$app/api-gateway.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/syncing-server-js.log" \
|
||||
--line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js-worker" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/syncing-server-js-worker.log" \
|
||||
--line_match='{"message":"Starting worker...","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/auth.log" \
|
||||
--line_match='{"message":"Server started on port '$port_auth'","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth-worker" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/auth-worker.log" \
|
||||
--line_match='{"message":"Starting worker...","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-api-gateway" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/api-gateway.log" \
|
||||
--line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}'
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
|
@ -163,7 +232,6 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=1
|
||||
|
||||
touch "/var/log/$app/$app.log"
|
||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
@ -177,13 +245,6 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=2
|
|||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# WAITING FOR SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Waiting for service..." --weight=1
|
||||
|
||||
is_service_ready
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
530
scripts/upgrade
530
scripts/upgrade
|
@ -21,17 +21,41 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
final_path_www=$(ynh_app_setting_get --app=$app --key=final_path_www)
|
||||
final_path_extensions=$(ynh_app_setting_get --app=$app --key=final_path_extensions)
|
||||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
|
||||
access_domain=$(echo $access_domain | sed "s@;@ @g")
|
||||
mail=$(ynh_app_setting_get --app=$app --key=mail)
|
||||
|
||||
port_syncing_server_js=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js)
|
||||
port_syncing_server_js_worker=$(ynh_app_setting_get --app=$app --key=port_syncing_server_js_worker)
|
||||
port_auth=$(ynh_app_setting_get --app=$app --key=port_auth)
|
||||
port_auth_worker=$(ynh_app_setting_get --app=$app --key=port_auth_worker)
|
||||
port_api_gateway=$(ynh_app_setting_get --app=$app --key=port_api_gateway)
|
||||
|
||||
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||
|
||||
config_file="$final_path/live/.env"
|
||||
jwt_secret=$(ynh_app_setting_get --app=$app --key=jwt_secret)
|
||||
legacy_jwt_secret=$(ynh_app_setting_get --app=$app --key=legacy_jwt_secret)
|
||||
auth_jwt_secret=$(ynh_app_setting_get --app=$app --key=auth_jwt_secret)
|
||||
pseudo_key_params_key=$(ynh_app_setting_get --app=$app --key=pseudo_key_params_key)
|
||||
encryption_server_key=$(ynh_app_setting_get --app=$app --key=encryption_server_key)
|
||||
|
||||
syncing_server_js_version_installed=$(ynh_app_setting_get --app=$app --key=syncing_server_js_version)
|
||||
auth_version_installed=$(ynh_app_setting_get --app=$app --key=auth_version)
|
||||
api_gateway_version_installed=$(ynh_app_setting_get --app=$app --key=api_gateway_version)
|
||||
extensions_version_installed=$(ynh_app_setting_get --app=$app --key=extension_version)
|
||||
|
||||
config_syncing_server_js="$final_path/live/syncing-server-js.env"
|
||||
config_syncing_server_js_worker="$final_path/live/syncing-server-js-worker.env"
|
||||
config_auth="$final_path/live/auth.env"
|
||||
config_auth_worker="$final_path/live/auth-worker.env"
|
||||
config_api_gateway="$final_path/live/api-gateway.env"
|
||||
|
||||
standalone=$(ynh_app_setting_get --app=$app --key=standalone)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -59,6 +83,39 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
if [[ ! $standalone ]];
|
||||
then
|
||||
ynh_remove_systemd_config --service=$app
|
||||
else
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js" \
|
||||
--action="stop" \
|
||||
--log_path="/var/log/$app/syncing-server-js.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js-worker" \
|
||||
--action="stop" \
|
||||
--log_path="/var/log/$app/syncing-server-js-worker.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth" \
|
||||
--action="stop" \
|
||||
--log_path="/var/log/$app/auth.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth-worker" \
|
||||
--action="stop" \
|
||||
--log_path="/var/log/$app/auth-worker.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-api-gateway" \
|
||||
--action="stop" \
|
||||
--log_path="/var/log/$app/api-gateway.log"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -71,10 +128,19 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
# Everyone can access the app.
|
||||
if [[ $(ynh_permission_exists --permission="main") && ! $standalone ]]
|
||||
then
|
||||
ynh_permission_update --permission="main" --add="visitors" --show_tile="false"
|
||||
fi
|
||||
if ! ynh_permission_exists --permission="main"
|
||||
then
|
||||
ynh_permission_create --permission="main" --url="/" --allowed="visitors" --show_tile="false"
|
||||
fi
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="help"
|
||||
then
|
||||
ynh_permission_create --permission="help" --url="/help" --allowed="all_users"
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
|
@ -83,16 +149,16 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# If access_domain doesn't exist, create it
|
||||
if [ -z "$access_domain" ]; then
|
||||
access_domain=$domain
|
||||
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path_www" ]; then
|
||||
final_path_www=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path_www --value=$final_path_www
|
||||
fi
|
||||
|
||||
# If mail doesn't exist, create it
|
||||
if [ -z "$mail" ]; then
|
||||
mail="$app@$domain"
|
||||
ynh_app_setting_set --app=$app --key=mail --value=$mail
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z "$final_path_extensions" ]; then
|
||||
final_path_extensions=/var/www/$app/extensions
|
||||
ynh_app_setting_set --app=$app --key=final_path_extensions --value=$final_path_extensions
|
||||
fi
|
||||
|
||||
# If redis_db doesn't exist, create it
|
||||
|
@ -101,103 +167,197 @@ if [ -z "$redis_db" ]; then
|
|||
ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
||||
fi
|
||||
|
||||
if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4"
|
||||
then
|
||||
# Add variables to .env config file
|
||||
echo -e "\
|
||||
\n# Public file server\
|
||||
\n# Empty is disabled\
|
||||
\n# Any value is enabled\
|
||||
\nRAILS_SERVE_STATIC_FILES=\
|
||||
" >> "$config_file"
|
||||
|
||||
# Apply Patch
|
||||
if [ -f "$YNH_CWD/../sources/patches/app-01-add-mail.patch" ]
|
||||
then
|
||||
pushd "$final_path/live"
|
||||
patch --strip=1 < "$YNH_CWD/../sources/patches/app-01-add-mail.patch"
|
||||
popd
|
||||
fi
|
||||
# If port_syncing_server_js doesn't exist, create it
|
||||
if [ -z "$port_syncing_server_js" ]; then
|
||||
port_syncing_server_js=$(ynh_find_port --port=3000)
|
||||
ynh_app_setting_set --app=$app --key=port_syncing_server_js --value=$port_syncing_server_js
|
||||
fi
|
||||
|
||||
if ynh_compare_current_package_version --comparison lt --version "3.20.4~ynh1"
|
||||
# If port_syncing_server_js_worker doesn't exist, create it
|
||||
if [ -z "$port_syncing_server_js_worker" ]; then
|
||||
port_syncing_server_js_worker=$(ynh_find_port --port=$((port_syncing_server_js+1)))
|
||||
ynh_app_setting_set --app=$app --key=port_syncing_server_js_worker --value=$port_syncing_server_js_worker
|
||||
fi
|
||||
|
||||
# If port_auth doesn't exist, create it
|
||||
if [ -z "$port_auth" ]; then
|
||||
port_auth=$(ynh_find_port --port=$((port_syncing_server_js_worker+1)))
|
||||
ynh_app_setting_set --app=$app --key=port_auth --value=$port_auth
|
||||
fi
|
||||
|
||||
# If port_auth_worker doesn't exist, create it
|
||||
if [ -z "$port_auth_worker" ]; then
|
||||
port_auth_worker=$(ynh_find_port --port=$((port_auth+1)))
|
||||
ynh_app_setting_set --app=$app --key=port_auth_worker --value=$port_auth_worker
|
||||
fi
|
||||
|
||||
# If port_api_gateway doesn't exist, create it
|
||||
if [ -z "$port_api_gateway" ]; then
|
||||
port_api_gateway=$(ynh_find_port --port=$((port_auth_worker+1)))
|
||||
ynh_app_setting_set --app=$app --key=port_api_gateway --value=$port_api_gateway
|
||||
fi
|
||||
|
||||
# If jwt_secret doesn't exist, create it
|
||||
if [ -z "$jwt_secret" ]; then
|
||||
jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||
ynh_app_setting_set --app=$app --key=jwt_secret --value=$jwt_secret
|
||||
fi
|
||||
|
||||
# If legacy_jwt_secret doesn't exist, create it
|
||||
if [ -z "$legacy_jwt_secret" ]; then
|
||||
legacy_jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||
ynh_app_setting_set --app=$app --key=legacy_jwt_secret --value=$legacy_jwt_secret
|
||||
fi
|
||||
|
||||
# If auth_jwt_secret doesn't exist, create it
|
||||
if [ -z "$auth_jwt_secret" ]; then
|
||||
auth_jwt_secret=$(ynh_string_random --length=48 | base64)
|
||||
ynh_app_setting_set --app=$app --key=auth_jwt_secret --value=$auth_jwt_secret
|
||||
fi
|
||||
|
||||
# If pseudo_key_params_key doesn't exist, create it
|
||||
if [ -z "$pseudo_key_params_key" ]; then
|
||||
pseudo_key_params_key=$(ynh_string_random --length=48 | base64)
|
||||
ynh_app_setting_set --app=$app --key=pseudo_key_params_key --value=$pseudo_key_params_key
|
||||
fi
|
||||
|
||||
# If encryption_server_key doesn't exist, create it
|
||||
if [ -z "$encryption_server_key" ]; then
|
||||
encryption_server_key=$(hexdump -n 32 -e '4/4 "%08X"' /dev/random) # 32bytes hex key is required
|
||||
ynh_app_setting_set --app=$app --key=encryption_server_key --value=$encryption_server_key
|
||||
fi
|
||||
|
||||
# Remove old Settings, Services, Files, Dependencies
|
||||
# If access_domain exist, delete it
|
||||
if [ -n $(ynh_app_setting_get --app="$app" --key=access_domain) ]; then
|
||||
ynh_app_setting_delete --app=$app --key=access_domain
|
||||
fi
|
||||
|
||||
# If mail exist, delete it
|
||||
if [ -n $(ynh_app_setting_get --app="$app" --key=mail) ]; then
|
||||
ynh_app_setting_delete --app=$app --key=mail
|
||||
fi
|
||||
|
||||
# If port exist, delete it
|
||||
if [ -n $(ynh_app_setting_get --app="$app" --key=port) ]; then
|
||||
ynh_app_setting_delete --app=$app --key=port
|
||||
fi
|
||||
|
||||
# If old service exsits; remove it
|
||||
if grep -q "$app:" "/etc/yunohost/services.yml"; then
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
# Remove old config scripts
|
||||
if [ -e "/etc/yunohost/apps/$app/config_panel.toml" ]; then
|
||||
ynh_secure_remove --file="/etc/yunohost/apps/$app/config_panel.toml"
|
||||
fi
|
||||
|
||||
if [ -e "/etc/yunohost/apps/$app/scripts/config" ]; then
|
||||
ynh_secure_remove --file="/etc/yunohost/apps/$app/scripts/config"
|
||||
fi
|
||||
|
||||
# Remove old dependencies
|
||||
if [[ ! $standalone ]];
|
||||
then
|
||||
# Add variables to .env config file
|
||||
echo -e "\
|
||||
\n# (Optional) Redis Cache for ephemeral sessions\
|
||||
\nREDIS_URL=redis://cache:6379\
|
||||
\n\
|
||||
\n# (Optional) Change URLs to Internal DNS\
|
||||
\n#INTERNAL_DNS_REROUTE_ENABLED=false\
|
||||
\n\
|
||||
\n# (Optional) Auth Proxy JWT Secret\
|
||||
\n#AUTH_JWT_SECRET=changeme123\
|
||||
\n\
|
||||
\n# (Optional) User Management Server - registration emails, subscriptions etc.\
|
||||
\n#USER_MANAGEMENT_SERVER=\
|
||||
" >> "$config_file"
|
||||
|
||||
# Change variables to .env config file
|
||||
ynh_replace_string \
|
||||
--match_string="RAILS_LOG_LEVEL=.*$" \
|
||||
--replace_string='# Log Level options: "INFO" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL"\nRAILS_LOG_LEVEL=INFO' \
|
||||
--target_file="$config_file"
|
||||
|
||||
ynh_replace_string --match_string="REDIS_URL.*$" --replace_string="REDIS_URL=redis://localhost:6379/$redis_db" --target_file="$config_file"
|
||||
|
||||
ynh_remove_ruby
|
||||
ynh_remove_app_dependencies
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
# Remove all files if the old syncing-server is used
|
||||
if [[ ! $standalone ]];
|
||||
then
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
fi
|
||||
|
||||
if [[ "$syncing_server_js_version_installed" < "$syncing_server_js_version" ]]
|
||||
then
|
||||
# Backup files to keep
|
||||
tmpdir=$(mktemp -d)
|
||||
if [ -f "$final_path/live/.env" ] ; then
|
||||
cp -Rp "$final_path/live/.env" "$tmpdir"
|
||||
fi
|
||||
if [ -d "$final_path/live/log" ] ; then
|
||||
cp -Rp "$final_path/live/log" "$tmpdir"
|
||||
fi
|
||||
ynh_backup_if_checksum_is_different --file=$config_syncing_server_js
|
||||
ynh_backup_if_checksum_is_different --file=$config_syncing_server_js_worker
|
||||
# Remove destination directory
|
||||
ynh_secure_remove --file="$final_path/live"
|
||||
ynh_secure_remove --file="$final_path/live/syncing_server_js"
|
||||
ynh_secure_remove --file="$config_syncing_server_js"
|
||||
ynh_secure_remove --file="$config_syncing_server_js_worker"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p "$final_path"
|
||||
ynh_setup_source --dest_dir="$final_path/live"
|
||||
if [ -f "$tmpdir/.env" ] ; then
|
||||
cp -Rp "$tmpdir/.env" "$final_path/live"
|
||||
fi
|
||||
if [ -d "$tmpdir/log" ] ; then
|
||||
cp -Rp "$tmpdir/log" "$final_path/live"
|
||||
fi
|
||||
mkdir -p "$final_path/live"
|
||||
ynh_setup_source --source_id=app_syncing-server-js --dest_dir="$final_path/live/syncing-server-js"
|
||||
fi
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_PACKAGE" ]
|
||||
if [[ "$auth_version_installed" < "$auth_version" ]]
|
||||
then
|
||||
ynh_secure_remove --file="$final_path/live/public/extensions"
|
||||
# Backup files to keep
|
||||
ynh_backup_if_checksum_is_different --file=$config_auth
|
||||
ynh_backup_if_checksum_is_different --file=$config_auth_worker
|
||||
# Remove destination directory
|
||||
ynh_secure_remove --file="$final_path/live/auth"
|
||||
ynh_secure_remove --file="$config_auth"
|
||||
ynh_secure_remove --file="$config_auth_worker"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p "$final_path/live"
|
||||
ynh_setup_source --source_id=app_auth --dest_dir="$final_path/live/auth"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$final_path/live/public/extensions/" || \
|
||||
! -d "$final_path/live/public/extensions/src/" ]]
|
||||
if [[ "$api_gateway_version_installed" < "$api_gateway_version" ]]
|
||||
then
|
||||
if test -e "../sources/extra_files/app"
|
||||
# Backup files to keep
|
||||
ynh_backup_if_checksum_is_different --file=$config_api_gateway
|
||||
# Remove destination directory
|
||||
ynh_secure_remove --file="$final_path/live/api_gateway"
|
||||
ynh_secure_remove --file="$config_api_gateway"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p "$final_path/live"
|
||||
ynh_setup_source --source_id=app_api-gateway --dest_dir="$final_path/live/api-gateway"
|
||||
fi
|
||||
|
||||
if [[ "$extensions_version_installed" < "$extensions_version" ]]
|
||||
then
|
||||
cp -a "../sources/extra_files/app/." "$final_path/live"
|
||||
# Remove destination directory
|
||||
ynh_secure_remove --file="$final_path_extensions"
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p "$final_path_extensions"
|
||||
if test -e "../sources/extra_files/extensions"
|
||||
then
|
||||
cp -a "../sources/extra_files/extensions/." "$final_path_extensions"
|
||||
fi
|
||||
|
||||
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||
do
|
||||
basename=$(basename -as .src $file)
|
||||
ynh_setup_source --dest_dir="$final_path_extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||
done
|
||||
fi
|
||||
|
||||
# Copy help file
|
||||
ynh_secure_remove --file="$final_path_www/help"
|
||||
mkdir -p "$final_path_www/help"
|
||||
if test -e "$YNH_APP_BASEDIR/sources/extra_files/help"; then
|
||||
cp --archive "$YNH_APP_BASEDIR/sources/extra_files/help/." "$final_path_www/help"
|
||||
fi
|
||||
ynh_replace_vars --file="$final_path_www/help/index.html"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
chmod 750 "$final_path_www"
|
||||
chmod -R o-rwx "$final_path_www"
|
||||
chown -R "www-data":"www-data" "$final_path_www"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -212,26 +372,9 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_ruby --ruby_version=$RUBY_VERSION
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# INSTALL RUBY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Ruby...( This may take a while... )" --weight=100 #331
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_use_ruby
|
||||
ynh_gem update --system --no-document
|
||||
ynh_gem install bundler --no-document
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -239,23 +382,13 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
config_file="$final_path/live/.env"
|
||||
ynh_script_progression --message="Modifying a config file..." --weight=2
|
||||
ynh_script_progression --message="Modify a config file..." --weight=2
|
||||
|
||||
if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4"
|
||||
then
|
||||
ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_USERNAME=.*$" --replace_string="#&" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_PASSWORD=.*$" --replace_string="#&" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="&\n# Enable STARTTLS\n# Empty is disabled\n# Any value is enabled\nSMTP_STARTTLS=" --target_file="$config_file"
|
||||
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
||||
fi
|
||||
|
||||
ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
|
||||
ynh_add_config --template="env_syncing-server-js.env.sample" --destination="$config_syncing_server_js"
|
||||
ynh_add_config --template="env_syncing-server-js-worker.env.sample" --destination="$config_syncing_server_js_worker"
|
||||
ynh_add_config --template="env_auth.env.sample" --destination="$config_auth"
|
||||
ynh_add_config --template="env_auth-worker.env.sample" --destination="$config_auth_worker"
|
||||
ynh_add_config --template="env_api-gateway.env.sample" --destination="$config_api_gateway"
|
||||
|
||||
#=================================================
|
||||
# INSTALLING Standard Notes - Syncing Server
|
||||
|
@ -263,22 +396,38 @@ ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --targ
|
|||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Installing Standard Notes - Syncing Server..." --weight=93
|
||||
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set --local path 'vendor/bundle'
|
||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle config set with 'development'
|
||||
ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
|
||||
ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate --quiet
|
||||
ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:seed --quiet
|
||||
# ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet
|
||||
ynh_use_nodejs
|
||||
if [[ "$syncing_server_js_version_installed" < "$syncing_server_js_version" ]]
|
||||
then
|
||||
pushd "$final_path/live/syncing-server-js"
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||
popd
|
||||
ynh_app_setting_set --app=$app --key=syncing_server_js_version --value=$syncing_server_js_version
|
||||
fi
|
||||
if [[ "$auth_version_installed" < "$auth_version" ]]
|
||||
then
|
||||
pushd "$final_path/live/auth"
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||
popd
|
||||
ynh_app_setting_set --app=$app --key=auth_version --value=$auth_version
|
||||
fi
|
||||
if [[ "$api_gateway_version_installed" < "$api_gateway_version" ]]
|
||||
then
|
||||
pushd "$final_path/live/api-gateway"
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn install --pure-lockfile
|
||||
ynh_exec_as $app env PATH=$ynh_node_load_PATH yarn build
|
||||
popd
|
||||
ynh_app_setting_set --app=$app --key=api_gateway_version --value=$api_gateway_version
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# INSTALLING Standard Notes - Extensions
|
||||
#=================================================
|
||||
if [[ "$extensions_version_installed" < "$extensions_version" ]]
|
||||
then
|
||||
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
||||
|
||||
if [ $path_url = "/" ]
|
||||
|
@ -288,18 +437,14 @@ else
|
|||
path=$path_url
|
||||
fi
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path_extensions/repo.json"
|
||||
|
||||
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
find "$final_path_extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||
do
|
||||
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
||||
done
|
||||
|
||||
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||
do
|
||||
basename=$(basename -as .src $file)
|
||||
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||
done
|
||||
ynh_app_setting_set --app=$app --key=extensions_version --value=$extensions_version
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -307,59 +452,52 @@ done
|
|||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_add_systemd_config --service="$app-syncing-server-js" --template="systemd_syncing-server-js.service"
|
||||
ynh_add_systemd_config --service="$app-syncing-server-js-worker" --template="systemd_syncing-server-js-worker.service"
|
||||
ynh_add_systemd_config --service="$app-auth" --template="systemd_auth.service"
|
||||
ynh_add_systemd_config --service="$app-auth-worker" --template="systemd_auth-worker.service"
|
||||
ynh_add_systemd_config --service="$app-api-gateway" --template="systemd_api-gateway.service"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$config_file"
|
||||
ynh_store_file_checksum --file="$config_syncing_server_js"
|
||||
ynh_store_file_checksum --file="$config_syncing_server_js_worker"
|
||||
ynh_store_file_checksum --file="$config_auth"
|
||||
ynh_store_file_checksum --file="$config_auth_worker"
|
||||
ynh_store_file_checksum --file="$config_api_gateway"
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
mkdir -p "$final_path/live/log"
|
||||
chown -R $app: "$final_path/live/log/"
|
||||
mkdir -p "$final_path/live/tmp"
|
||||
chown -R $app: "$final_path/live/tmp/"
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R $app: "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R "$app": "/var/log/$app"
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --logfile="$final_path/live/log/production.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/$app.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/syncing-server.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/syncing-server-worker.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/auth.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/auth-worker.log"
|
||||
ynh_use_logrotate --logfile="/var/log/$app/api-gateway.log"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrate $app service in Yunohost..." --weight=1
|
||||
|
||||
yunohost service add $app --description "Standard Notes - Syncing Server" --log "/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=1
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
touch "/var/log/$app/$app.log"
|
||||
ynh_add_fail2ban_config --use_template
|
||||
yunohost service add "$app-syncing-server-js" --description="Standard Notes - Syncing Server" --log="/var/log/$app/syncing-server-js.log"
|
||||
yunohost service add "$app-syncing-server-js-worker" --description="Standard Notes - Syncing Server - Worker" --log="/var/log/$app/syncing-server-js-worker.log"
|
||||
yunohost service add "$app-auth" --description="Standard Notes - Auth" --log="/var/log/$app/auth.log"
|
||||
yunohost service add "$app-auth-worker" --description="Standard Notes - Auth - Worker" --log="/var/log/$app/auth-worker.log"
|
||||
yunohost service add "$app-api-gateway" --description="Standard Notes - API Gateway" --log="/var/log/$app/api-gateway.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -367,7 +505,39 @@ ynh_add_fail2ban_config --use_template
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/syncing-server-js.log" \
|
||||
--line_match='{"message":"Server started on port '$port_syncing_server_js'","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-syncing-server-js-worker" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/syncing-server-js-worker.log" \
|
||||
--line_match='{"message":"Starting worker...","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/auth.log" \
|
||||
--line_match='{"message":"Server started on port '$port_auth'","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-auth-worker" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/auth-worker.log" \
|
||||
--line_match='{"message":"Starting worker...","level":"info"}'
|
||||
ynh_systemd_action \
|
||||
--service_name="$app-api-gateway" \
|
||||
--action="start" \
|
||||
--log_path="/var/log/$app/api-gateway.log" \
|
||||
--line_match='{"message":"Server started on port '$port_api_gateway'","level":"info"}'
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=1
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --use_template
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
@ -376,13 +546,6 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# WAITING FOR SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Waiting for service..." --weight=1
|
||||
|
||||
is_service_ready
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
@ -391,11 +554,7 @@ ynh_script_progression --message="Sending a readme for the admin..."
|
|||
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
|
||||
config_panel="You can find some specific configurations for this app by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__"
|
||||
admin_mail_info="\
|
||||
New Feature ( 3.13.6~ynh4 ):\n\
|
||||
Now Standard Notes extensions are hosted with this package.\n\
|
||||
Only new users will get an e-mail with install instructions.\n\
|
||||
With the current SMTP settings you can not send e-mails to all e-mail providers. For example GMail will probably not recive this e-mails.\n\
|
||||
Please setup the SMTP account in this file: \"$final_path/live/.env\" under \"#Mailer settings\" if you want to fix this.\n\
|
||||
Standard Notes extensions are hosted with this package.\n\
|
||||
Please setup the Access-Domain for the extensions in the __URL_TAG1__config-panel__URL_TAG2__$admin_panel/config-panel__URL_TAG3__\
|
||||
"
|
||||
|
||||
|
@ -408,6 +567,11 @@ $admin_mail_info\
|
|||
|
||||
ynh_send_readme_to_admin --app_message="message" --type='upgrade'
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS
|
||||
#=================================================
|
||||
ynh_app_setting_set --app=$app --key=standalone --value="true"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -297,7 +297,7 @@ ynh_cleanup_ruby () {
|
|||
if [[ ! $required_ruby_versions ]]
|
||||
then
|
||||
# Remove rbenv environment configuration
|
||||
ynh_print_info --message="Removing of rbenv-$rbenv_version"
|
||||
ynh_print_info --message="Removing of rbenv"
|
||||
ynh_secure_remove --file="$rbenv_install_dir"
|
||||
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
|
||||
fi
|
||||
|
|
2
sources/extra_files/app/.gitignore
vendored
2
sources/extra_files/app/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*~
|
||||
*.sw[op]
|
|
@ -1,223 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html style="font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; box-sizing: border-box; margin: 0; padding: 0;">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<style>
|
||||
.sn-component .sk-panel a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.sn-component .sk-menu-panel .row:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
.sn-component .sk-menu-panel .row .column .row:hover,
|
||||
.sn-component .sk-menu-panel .row .column .subrow:hover {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
.sn-component .sk-button.default:hover,
|
||||
.sn-component .default.sk-box:hover,
|
||||
.sn-component .default.sk-circle:hover,
|
||||
.sn-component .sk-box.default:hover,
|
||||
.sn-component .sk-circle.default:hover {
|
||||
background-color: white; color: #939393;
|
||||
}
|
||||
.sn-component .sk-button.default.featured:hover,
|
||||
.sn-component .default.featured.sk-box:hover,
|
||||
.sn-component .default.featured.sk-circle:hover,
|
||||
.sn-component .sk-box.default.featured:hover,
|
||||
.sn-component .sk-circle.default.featured:hover {
|
||||
background-color: #9f9f9f;
|
||||
}
|
||||
.sn-component .sk-button.info:hover,
|
||||
.sn-component .info.sk-box:hover,
|
||||
.sn-component .info.sk-circle:hover,
|
||||
.sn-component .sk-box.info:hover,
|
||||
.sn-component .sk-circle.info:hover {
|
||||
background-color: #d5e9fd; color: #0975e5;
|
||||
}
|
||||
.sn-component .sk-button.info.featured:hover,
|
||||
.sn-component .info.featured.sk-box:hover,
|
||||
.sn-component .info.featured.sk-circle:hover,
|
||||
.sn-component .sk-box.info.featured:hover,
|
||||
.sn-component .sk-circle.info.featured:hover {
|
||||
background-color: #1181f6;
|
||||
}
|
||||
.sn-component .sk-button.warning:hover,
|
||||
.sn-component .warning.sk-box:hover,
|
||||
.sn-component .warning.sk-circle:hover,
|
||||
.sn-component .sk-box.warning:hover,
|
||||
.sn-component .sk-circle.warning:hover {
|
||||
background-color: #fff8ec; color: #ffaa06;
|
||||
}
|
||||
.sn-component .sk-button.warning.featured:hover,
|
||||
.sn-component .warning.featured.sk-box:hover,
|
||||
.sn-component .warning.featured.sk-circle:hover,
|
||||
.sn-component .sk-box.warning.featured:hover,
|
||||
.sn-component .sk-circle.warning.featured:hover {
|
||||
background-color: #ffb320;
|
||||
}
|
||||
.sn-component .sk-button.danger:hover,
|
||||
.sn-component .danger.sk-box:hover
|
||||
.sn-component .danger.sk-circle:hover,
|
||||
.sn-component .sk-box.danger:hover,
|
||||
.sn-component .sk-circle.danger:hover {
|
||||
background-color: #fff1f3; color: #fc0e2e;
|
||||
}
|
||||
.sn-component .sk-button.danger.featured:hover,
|
||||
.sn-component .danger.featured.sk-box:hover,
|
||||
.sn-component .danger.featured.sk-circle:hover,
|
||||
.sn-component .sk-box.danger.featured:hover,
|
||||
.sn-component .sk-circle.danger.featured:hover {
|
||||
background-color: #fc2744;
|
||||
}
|
||||
.sn-component .sk-button.success:hover,
|
||||
.sn-component .success.sk-box:hover,
|
||||
.sn-component .success.sk-circle:hover,
|
||||
.sn-component .sk-box.success:hover,
|
||||
.sn-component .sk-circle.success:hover {
|
||||
background-color: #b7f5a8; color: #2fa414;
|
||||
}
|
||||
.sn-component .sk-button.success.featured:hover,
|
||||
.sn-component .success.featured.sk-box:hover,
|
||||
.sn-component .success.featured.sk-circle:hover,
|
||||
.sn-component .sk-box.success.featured:hover,
|
||||
.sn-component .sk-circle.success.featured:hover {
|
||||
background-color: #35ba16;
|
||||
}
|
||||
.sn-component .sk-notification.info.featured:hover {
|
||||
background-color: #1181f6;
|
||||
}
|
||||
.sn-component .sk-notification.warning.featured:hover {
|
||||
background-color: #ffb320;
|
||||
}
|
||||
body {
|
||||
font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; margin: 0; padding: 0;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
html {
|
||||
font-size: 17px !important;
|
||||
}
|
||||
body {
|
||||
font-size: 17px !important;
|
||||
}
|
||||
.sn-component .sk-panel .sk-panel-content {
|
||||
padding: 0.5rem 1.1rem !important;
|
||||
}
|
||||
.sn-component .sk-panel .sk-panel-footer {
|
||||
padding: 0.5rem 1.1rem !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body style="font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; box-sizing: border-box; margin: 0; padding: 0;">
|
||||
<div class="sn-component" style='font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; box-sizing: border-box;'>
|
||||
<div class="sk-panel static" style="border-radius: 0; overflow: visible; box-shadow: none; box-sizing: border-box; border: none;">
|
||||
<div class="sk-panel-content" style="overflow: visible; overflow-y: visible !important; overflow-x: visible !important; box-sizing: border-box; padding: 1.6rem 2rem 0;">
|
||||
<div class="sk-panel-section" style="padding-bottom: 1.6rem; margin-bottom: 1.5rem; border-bottom-color: #DDDDDD; border-bottom-width: 1px; border-bottom-style: solid; box-sizing: border-box;">
|
||||
<div class="h1 title sk-panel-row" style="justify-content: space-between; align-items: center; padding-top: 0.4rem; padding-bottom: 0.4rem; font-size: 1.5rem !important; box-sizing: border-box;">
|
||||
<div class="sk-panel-column" style="box-sizing: border-box;">
|
||||
Welcome to
|
||||
<strong style="box-sizing: border-box;">Standard Notes.</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="faded sk-panel-row small" style="justify-content: space-between; align-items: center; padding-top: 0.4rem; font-size: 14px !important; opacity: 0.5; box-sizing: border-box;">
|
||||
Registered as <%= @email %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sk-panel-section" style="padding-bottom: 1.6rem; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
|
||||
<i style="box-sizing: border-box;">Hi there,</i>
|
||||
</p>
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
|
||||
Welcome to your new private notes account.
|
||||
We created Standard Notes to be a safe, private, and lasting place for your most important work.
|
||||
</p>
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
|
||||
<strong style="box-sizing: border-box;">You should know:</strong>
|
||||
</p>
|
||||
<ol style="box-sizing: border-box;">
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Your notes are fully encrypted on your device before they're ever sent to our servers.
|
||||
This means even we can't read the contents of your notes.
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Standard Notes is available on all your devices. Download the
|
||||
<a href="https://itunes.apple.com/us/app/standard-notes/id1285392450?mt=8" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">iOS</a>
|
||||
and
|
||||
<a href="https://play.google.com/store/apps/details?id=com.standardnotes" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Android</a>
|
||||
app to go mobile. Use the
|
||||
<a href="https://app.standardnotes.org" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">web app</a> on the go. Or download the desktop app on
|
||||
<a href="https://standardnotes.org/download/mac" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Mac</a>, <a href="https://standardnotes.org/download/windows" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Windows</a>, and <a href="https://standardnotes.org/download/linux" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Linux</a>.
|
||||
</li>
|
||||
</ol>
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
|
||||
<strong style="box-sizing: border-box;">Install instructions for Extensions:</strong>
|
||||
</p>
|
||||
<ol style="box-sizing: border-box;">
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Open the Standard Notes web or Desktop app
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Press <strong>Extensions</strong> in the button left corner
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Press on <strong>Import Extensions</strong> in the button right corner of the new window.
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Enter <strong>https://__DOMAIN____PATH__/extensions/repo.json</strong> in the field.
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Press <strong>Enter</strong> on your keyboard.
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
Now you can see Editors, Themes and Components which you can install
|
||||
</li>
|
||||
</ol>
|
||||
<h4 class="sk-panel-row" style="justify-content: space-between; align-items: center; font-weight: bold; font-size: 0.95rem; line-height: 1.4rem; box-sizing: border-box; margin: 0; padding: 0.4rem 0;">To have all Standard Notes extensions use <strong>Standard Notes Extened</strong>:</h4>
|
||||
<div class="sk-panel-row" style="justify-content: space-between; align-items: center; padding-top: 0.4rem; padding-bottom: 0.4rem; box-sizing: border-box;"></div>
|
||||
<div class="horizontal-blocks center extended boxed gray" style="box-sizing: border-box;">
|
||||
<div class="h-block blue-stroke purchase-box" style="width: 100%; box-sizing: border-box; background-color: #f8f8f8; color: black !important; border-radius: 3px !important; margin-right: 40px; margin-bottom: 40px; padding: 15px 30px 30px; border: 1px solid #086dd6;">
|
||||
<p class="box-title" style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; font-size: 26px; margin: 0.5rem 0 20px;">Standard Notes <strong class="extended-text" style="box-sizing: border-box; border-left-style: solid; border-left-color: #086dd6; border-left-width: 3px; padding-left: 10px; margin-left: 5px;">Extended</strong></p>
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
|
||||
Unlock entirely new workflows with powerful editors and cloud backup options
|
||||
with
|
||||
<a href="https://standardnotes.org/extensions" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Extended.</a>
|
||||
Extended is our paid extensions program, and how we support continued development on Standard Notes.
|
||||
</p>
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
|
||||
<strong style="box-sizing: border-box;">Benefits:</strong>
|
||||
</p>
|
||||
<ul class="no-bullet" style="list-style-type: none !important; padding-left: 0; margin-left: 0; box-sizing: border-box;">
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">✓</span> Encrypted attachments for your notes stored directly in your Dropbox, Google Drive, or WebDAV.</p>
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">✓</span> Unlimited access to powerful extensions, editors, and beautiful themes.</p>
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">✓</span> Note version history (up to 100 years)</p>
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">✓</span> Automatic daily backups of your data to your email inbox, Dropbox, OneDrive, and Google Drive</p>
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">✓</span> Two-factor authentication</p>
|
||||
</li>
|
||||
<li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">✓</span> Support our mission for privacy and longevity in software</p>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="price-box blue" href="https://standardnotes.org/extensions" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">
|
||||
<p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">As low as</p>
|
||||
<h1 class="amount" style="font-weight: 500; font-size: 1.5rem !important; line-height: 1.9rem; box-sizing: border-box; margin: 0; padding: 0;">$2.48/month</h1>
|
||||
</a>
|
||||
<a class="sk-button info right featured" style="margin-top: 20px; cursor: pointer; color: white; text-decoration: none; display: block; font-size: 1.1rem; text-align: center; background-color: #086DD6; box-sizing: border-box; padding: 0.75rem 1.25rem; border: 1px none #086dd6;" href="https://standardnotes.org/extensions">
|
||||
<div class="sk-label" style="font-weight: bold; box-sizing: border-box;">Learn More</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -62,12 +62,12 @@
|
|||
"foreground_color": "#ffffff",
|
||||
"type": "circle"
|
||||
},
|
||||
"download_url": "https://github.com/standardnotes/midnight-theme/archive/1.2.1.zip",
|
||||
"download_url": "https://github.com/standardnotes/midnight-theme/archive/1.2.2.zip",
|
||||
"identifier": "org.standardnotes.midnight-theme",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme.json",
|
||||
"name": "Midnight Theme",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme/dist/dist.css",
|
||||
"version": "1.2.1"
|
||||
"version": "1.2.2"
|
||||
},
|
||||
{
|
||||
"area": "theme",
|
||||
|
@ -137,12 +137,12 @@
|
|||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "A simple and peaceful rich editor that helps you write and think clearly. Features FileSafe integration, so you can embed your images, videos, and audio recordings directly inline.",
|
||||
"download_url": "https://github.com/standardnotes/bold-editor/archive/1.1.0.zip",
|
||||
"download_url": "https://github.com/standardnotes/bold-editor/archive/1.2.1.zip",
|
||||
"identifier": "org.standardnotes.bold-editor",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/bold-editor.json",
|
||||
"name": "Bold Editor",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/bold-editor/dist/index.html",
|
||||
"version": "1.1.0"
|
||||
"version": "1.2.1"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
|
@ -159,23 +159,23 @@
|
|||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "A Markdown editor with dynamic split-pane preview.",
|
||||
"download_url": "https://github.com/standardnotes/markdown-basic/archive/1.3.7.zip",
|
||||
"download_url": "https://github.com/standardnotes/markdown-basic/archive/1.4.0.zip",
|
||||
"identifier": "org.standardnotes.markdown-basic-editor",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic.json",
|
||||
"name": "Markdown Basic",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic/dist/index.html",
|
||||
"version": "1.3.7"
|
||||
"version": "1.4.0"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.",
|
||||
"download_url": "https://github.com/standardnotes/markdown-pro/archive/1.3.9.zip",
|
||||
"download_url": "https://github.com/standardnotes/markdown-pro/archive/1.3.14.zip",
|
||||
"identifier": "org.standardnotes.markdown-pro",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro.json",
|
||||
"name": "Markdown Pro",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro/index.html",
|
||||
"version": "1.3.9"
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro/dist/index.html",
|
||||
"version": "1.3.14"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
|
@ -192,45 +192,45 @@
|
|||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "A minimal Markdown editor with inline style support.",
|
||||
"download_url": "https://github.com/standardnotes/minimal-markdown-editor/archive/1.3.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/minimal-markdown-editor/archive/1.3.7.zip",
|
||||
"identifier": "org.stndardnotes.minimal-markdown-editor",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor.json",
|
||||
"name": "Minimal Markdown Editor",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor/index.html",
|
||||
"version": "1.3.5"
|
||||
"version": "1.3.7"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "From highlighting to custom font sizes and colors, to tables and lists, this editor is perfect for crafting any document. (Converts your note to an HTML format.)",
|
||||
"download_url": "https://github.com/standardnotes/plus-editor/archive/1.4.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/plus-editor/archive/1.5.0.zip",
|
||||
"identifier": "org.standardnotes.plus-editor",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/plus-editor.json",
|
||||
"name": "Plus Editor",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/plus-editor/dist/index.html",
|
||||
"version": "1.4.5"
|
||||
"version": "1.5.0"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "A great way to manage short-term and long-term to-do's. You can mark simple-tasks as completed, change their order, and edit the text naturally in place.",
|
||||
"download_url": "https://github.com/standardnotes/simple-task-editor/archive/1.3.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/simple-task-editor/archive/1.3.7.zip",
|
||||
"identifier": "org.standardnotes.simple-task-editor",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor.json",
|
||||
"name": "Task Editor",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor/dist/index.html",
|
||||
"version": "1.3.5"
|
||||
"version": "1.3.7"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
"content_type": "SN|Component",
|
||||
"description": "Use Standard Notes on both desktop and mobile as your authenticator app. TokenVault handles your 2FA secrets so that you never lose them again, or have to start over when you get a new device.",
|
||||
"download_url": "https://github.com/standardnotes/token-vault/archive/1.0.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/token-vault/archive/1.0.10.zip",
|
||||
"identifier": "org.stndardnotes.token-vault",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/token-vault.json",
|
||||
"name": "Token Vault",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/token-vault/dist/index.html",
|
||||
"version": "1.0.5"
|
||||
"version": "1.0.10"
|
||||
},
|
||||
{
|
||||
"area": "editor-editor",
|
||||
|
@ -247,23 +247,23 @@
|
|||
"area": "editor-stack",
|
||||
"content_type": "SN|Component",
|
||||
"description": "Useful utility bar with information about the current note as well as actions like duplicate, copy, and save.",
|
||||
"download_url": "https://github.com/standardnotes/action-bar/archive/1.3.1.zip",
|
||||
"download_url": "https://github.com/standardnotes/action-bar/archive/1.3.2.zip",
|
||||
"identifier": "org.stndardnotes.action-bar",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/action-bar.json",
|
||||
"name": "Action Bar",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/action-bar/index.html",
|
||||
"version": "1.3.1"
|
||||
"version": "1.3.2"
|
||||
},
|
||||
{
|
||||
"area": "tags-list",
|
||||
"content_type": "SN|Component",
|
||||
"description": "Create nested folders from your tags with easy drag and drop. Folders also supports Smart Tags, which allow you to build custom filters for viewing your notes.",
|
||||
"download_url": "https://github.com/standardnotes/folders-component/archive/1.3.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/folders-component/archive/1.3.8.zip",
|
||||
"identifier": "org.stndardnotes.folders-component",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/folders-component.json",
|
||||
"name": "Folders",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/folders-component/index.html",
|
||||
"version": "1.3.5"
|
||||
"version": "1.3.8"
|
||||
},
|
||||
{
|
||||
"area": "editor-stack",
|
||||
|
@ -280,12 +280,12 @@
|
|||
"area": "modal",
|
||||
"content_type": "SN|Component",
|
||||
"description": "Set up 2FA to enable an extra layer of security on your private notes account.",
|
||||
"download_url": "https://github.com/standardnotes/mfa-link/archive/1.2.2.zip",
|
||||
"download_url": "https://github.com/standardnotes/mfa-link/archive/1.2.4.zip",
|
||||
"identifier": "org.stndardnotes.mfa-link",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/mfa-link.json",
|
||||
"name": "MFA-Link",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/mfa-link/dist/index.html",
|
||||
"version": "1.2.2"
|
||||
"version": "1.2.4"
|
||||
},
|
||||
{
|
||||
"area": "note-tags",
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Action Bar",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-stack",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "Useful utility bar with information about the current note as well as actions like duplicate, copy, and save.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/action-bar/index.html",
|
||||
"download_url": "https://github.com/standardnotes/action-bar/archive/1.3.1.zip",
|
||||
"download_url": "https://github.com/standardnotes/action-bar/archive/1.3.2.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/action-bar.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Bold Editor",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.1",
|
||||
"description": "A simple and peaceful rich editor that helps you write and think clearly. Features FileSafe integration, so you can embed your images, videos, and audio recordings directly inline.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/bold-editor/dist/index.html",
|
||||
"download_url": "https://github.com/standardnotes/bold-editor/archive/1.1.0.zip",
|
||||
"download_url": "https://github.com/standardnotes/bold-editor/archive/1.2.1.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/bold-editor.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Folders",
|
||||
"content_type": "SN|Component",
|
||||
"area": "tags-list",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.8",
|
||||
"description": "Create nested folders from your tags with easy drag and drop. Folders also supports Smart Tags, which allow you to build custom filters for viewing your notes.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/folders-component/index.html",
|
||||
"download_url": "https://github.com/standardnotes/folders-component/archive/1.3.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/folders-component/archive/1.3.8.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/folders-component.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Markdown Basic",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.3.7",
|
||||
"version": "1.4.0",
|
||||
"description": "A Markdown editor with dynamic split-pane preview.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic/dist/index.html",
|
||||
"download_url": "https://github.com/standardnotes/markdown-basic/archive/1.3.7.zip",
|
||||
"download_url": "https://github.com/standardnotes/markdown-basic/archive/1.4.0.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Markdown Pro",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.3.9",
|
||||
"version": "1.3.14",
|
||||
"description": "A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro/index.html",
|
||||
"download_url": "https://github.com/standardnotes/markdown-pro/archive/1.3.9.zip",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro/dist/index.html",
|
||||
"download_url": "https://github.com/standardnotes/markdown-pro/archive/1.3.14.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "MFA-Link",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-stack",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.4",
|
||||
"description": "Set up 2FA to enable an extra layer of security on your private notes account.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/mfa-link/dist/index.html",
|
||||
"download_url": "https://github.com/sn-extensions/mfa-link/archive/1.2.2.zip",
|
||||
"download_url": "https://github.com/sn-extensions/mfa-link/archive/1.2.4.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/mfa-link.json"
|
||||
}
|
|
@ -3,10 +3,10 @@
|
|||
"name": "Midnight Theme",
|
||||
"content_type": "SN|Theme",
|
||||
"area": "theme",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"description": "Elegant utilitarianism.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme/dist/dist.css",
|
||||
"download_url": "https://github.com/sn-extensions/midnight-theme/archive/1.2.1.zip",
|
||||
"download_url": "https://github.com/sn-extensions/midnight-theme/archive/1.2.2.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme.json",
|
||||
"dock_icon":{
|
||||
"type":"circle",
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Minimal Markdown Editor",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.7",
|
||||
"description": "A minimal Markdown editor with inline style support.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor/index.html",
|
||||
"download_url": "https://github.com/sn-extensions/minimal-markdown-editor/archive/1.3.5.zip",
|
||||
"download_url": "https://github.com/sn-extensions/minimal-markdown-editor/archive/1.3.7.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Plus Editor",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.4.5",
|
||||
"version": "1.5.0",
|
||||
"description": "From highlighting to custom font sizes and colors, to tables and lists, this editor is perfect for crafting any document. (Converts your note to an HTML format.)",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/plus-editor/dist/index.html",
|
||||
"download_url": "https://github.com/standardnotes/plus-editor/archive/1.4.5.zip",
|
||||
"download_url": "https://github.com/standardnotes/plus-editor/archive/1.5.0.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/plus-editor.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Task Editor",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.3.5",
|
||||
"version": "1.3.7",
|
||||
"description": "A great way to manage short-term and long-term to-do's. You can mark simple-tasks as completed, change their order, and edit the text naturally in place.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor/dist/index.html",
|
||||
"download_url": "https://github.com/sn-extensions/simple-task-editor/archive/1.3.5.zip",
|
||||
"download_url": "https://github.com/sn-extensions/simple-task-editor/archive/1.3.7.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor.json"
|
||||
}
|
|
@ -3,9 +3,9 @@
|
|||
"name": "Token Vault",
|
||||
"content_type": "SN|Component",
|
||||
"area": "editor-editor",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.10",
|
||||
"description": "Use Standard Notes on both desktop and mobile as your authenticator app. TokenVault handles your 2FA secrets so that you never lose them again, or have to start over when you get a new device.",
|
||||
"url": "https://__DOMAIN__PATH__/extensions/src/token-vault/dist/index.html",
|
||||
"download_url": "https://github.com/sn-extensions/token-vault/archive/1.0.5.zip",
|
||||
"download_url": "https://github.com/sn-extensions/token-vault/archive/1.0.10.zip",
|
||||
"latest_url": "https://__DOMAIN__PATH__/extensions/src/token-vault.json"
|
||||
}
|
82
sources/extra_files/help/index.html
Normal file
82
sources/extra_files/help/index.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title> Standard Notes - Syncing Server </title>
|
||||
<style>
|
||||
body {
|
||||
padding-top: 15px;
|
||||
text-align: center;
|
||||
font-family: sans-serif;
|
||||
min-width: 985px;
|
||||
}
|
||||
p, ol {
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
font-size: x-large;
|
||||
}
|
||||
div {
|
||||
width: 940px;
|
||||
margin-right: auto;
|
||||
margin-left: auto;
|
||||
text-align: left;
|
||||
}
|
||||
a {
|
||||
cursor: pointer;
|
||||
color: #086dd6;
|
||||
box-sizing: border-box;
|
||||
text-decoration: none;
|
||||
}
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Standard Notes - Sycning Server</h1>
|
||||
<p>Add <strong>https://__DOMAIN____PATH__/</strong> as Sync Server Domain in the Advanced Options to use this Syncing Server.</p>
|
||||
<div>
|
||||
<p>
|
||||
<strong>You should know:</strong>
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
Your notes are fully encrypted on your device before they're ever sent to our servers.<br>
|
||||
This means even we can't read the contents of your notes.
|
||||
</li>
|
||||
<li>
|
||||
Standard Notes is available on all your devices.
|
||||
<ul>
|
||||
<li><a href="https://itunes.apple.com/us/app/standard-notes/id1285392450?mt=8" target="_blank" rel="noreferrer">iOS</a></li>
|
||||
<li><a href="https://play.google.com/store/apps/details?id=com.standardnotes" target="_blank" rel="noreferrer">Android</a></li>
|
||||
<li><a href="https://app.standardnotes.org" target="_blank" rel="noreferrer">Web App</a></li>
|
||||
<li><a href="https://standardnotes.org/download/mac" target="_blank" rel="noreferrer">Mac</a></li>
|
||||
<li><a href="https://standardnotes.org/download/windows" target="_blank" rel="noreferrer">Windows</a></li>
|
||||
<li><a href="https://standardnotes.org/download/linux" target="_blank" rel="noreferrer">Linux</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ol>
|
||||
<p>
|
||||
<strong>Install instructions for Extensions:</strong>
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
Open the Standard Notes web or Desktop app
|
||||
</li>
|
||||
<li>
|
||||
Press <strong>Extensions</strong> in the button left corner
|
||||
</li>
|
||||
<li>
|
||||
Enter <strong>https://__DOMAIN____PATH__/extensions/repo.json</strong> in the textbox.
|
||||
</li>
|
||||
<li>
|
||||
Press the <strong>Submit Code</strong> button.
|
||||
</li>
|
||||
<li>
|
||||
Now you can see Editors, Themes and Components which you can install
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/config.ru b/config.ru
|
||||
index bd83b25..6b1bb50 100644
|
||||
--- a/config.ru
|
||||
+++ b/config.ru
|
||||
@@ -1,4 +1,6 @@
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path('../config/environment', __FILE__)
|
||||
-run Rails.application
|
||||
+map ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
|
||||
+ run Rails.application
|
||||
+end
|
|
@ -1,49 +0,0 @@
|
|||
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
|
||||
index a813bad..b7f2e2f 100644
|
||||
--- a/app/mailers/application_mailer.rb
|
||||
+++ b/app/mailers/application_mailer.rb
|
||||
@@ -1,4 +1,4 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
- default from: 'Standard Notes <help@standardnotes.org>'
|
||||
+ default from: 'Standard Notes <__MAIL__>'
|
||||
layout 'mailer'
|
||||
end
|
||||
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
|
||||
index 6bbbb11..ac7f55e 100644
|
||||
--- a/app/mailers/user_mailer.rb
|
||||
+++ b/app/mailers/user_mailer.rb
|
||||
@@ -25,4 +25,9 @@ class UserMailer < ApplicationMailer
|
||||
user = User.find(user_id)
|
||||
mail(to: user.email, subject: 'Two-factor authentication has been disabled for your account.')
|
||||
end
|
||||
+
|
||||
+ def welcome(user)
|
||||
+ @email = user.email
|
||||
+ mail(to: @email, subject: 'Welcome to your private notes account')
|
||||
+ end
|
||||
end
|
||||
diff --git a/config/application.rb b/config/application.rb
|
||||
index 3c749e2..feff27c 100644
|
||||
--- a/config/application.rb
|
||||
+++ b/config/application.rb
|
||||
@@ -79,7 +79,7 @@ module SyncingServer
|
||||
:user_name => ENV['SMTP_USERNAME'],
|
||||
:password => ENV['SMTP_PASSWORD'],
|
||||
:authentication => 'login',
|
||||
- :enable_starttls_auto => true # detects and uses STARTTLS
|
||||
+ :enable_starttls_auto => ENV['SMTP_STARTTLS'].present? # detects and uses STARTTLS
|
||||
}
|
||||
|
||||
# Custom configuration
|
||||
diff --git a/lib/sync_engine/abstract/user_manager.rb b/lib/sync_engine/abstract/user_manager.rb
|
||||
index 26a549a..af92835 100644
|
||||
--- a/lib/sync_engine/abstract/user_manager.rb
|
||||
+++ b/lib/sync_engine/abstract/user_manager.rb
|
||||
@@ -29,6 +29,7 @@ module SyncEngine
|
||||
else
|
||||
user = @user_class.new(email: email, encrypted_password: hash_password(password))
|
||||
user.update!(registration_params(params))
|
||||
+ UserMailer.welcome(user).deliver_later
|
||||
return success_auth_response(user, params)
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue