installation_de_standardnotes
Ceci est une ancienne révision du document !
Le déploiement de standardnotes nécessite 3 nom de domaine :
- Une pour le service api-gateway qui se trouve devant auth et syncing-server-js)
- Une pour l'interface web
- Une autre pour les extentions
Exemple :
- notes.mondomaine.fr
- api.notes.mondomaine.fr
- ext.notes.mondomaine.fr
- install.sh
apt update && apt install wget -y && wget -O - https://deb.lgy.fr | bash && amp-full-upgrade apt install redis git build-essential python2 -y wget -qO - https://deb.nodesource.com/setup_15.x | bash - apt-get install -y nodejs mkdir /etc/standardnotes npm install -g yarn useradd standardnotes -r -s /bin/false -m -d /usr/lib/standardnotes cd /usr/lib/standardnotes su - -s $(which bash) standardnotes << 'EOF' for tmp in auth syncing-server-js api-gateway do cd /usr/lib/standardnotes/ git clone https://github.com/standardnotes/$tmp.git cd /usr/lib/standardnotes/$tmp/ npm install npm run build done cd /usr/lib/standardnotes/ PATH=$PATH:~/web/bin git clone https://github.com/standardnotes/web.git cd /usr/lib/standardnotes/web/ npm install npm run setup npm run bundle EOF cat << 'EOF' > /usr/lib/standardnotes/web/webpack.dev.js const { merge } = require('webpack-merge'); const config = require('./webpack.config.js'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = (env, argv) => { const port = argv.port || 3004; return merge(config(env, argv), { mode: 'development', /** Only create an html file for the dev-server */ plugins: argv.liveReload ? [ new HtmlWebpackPlugin({ template: './index.html', templateParameters: { env: process.env }, }), ] : [], devServer: { disableHostCheck: true, host: '0.0.0.0', proxy: { '/extensions': { target: `http://standardnotes.net.lgy.fr:${port}`, pathRewrite: { '^/extensions': '/public/extensions' } }, '/assets': { target: `http://standardnotes.net.lgy.fr:${port}`, pathRewrite: { '^/assets': '/public/assets' } }, }, port, writeToDisk: argv.writeToDisk, } }); }; EOF create user stdnotesauth@standardnotes.net.lgy.fr identified by 'OilOnotodfeOsyuItFijghorwodruefKojliNemVekekVogMamWiavOsfolyiej5'; create database IF NOT EXISTS stdnotesauth ; grant all privileges on stdnotesauth.* to stdnotesauth@standardnotes.net.lgy.fr; create user stdnotes@standardnotes.net.lgy.fr identified by 'OilOnotodfeOsyuItFijghorwodruefKojliNemVekekVogMamWiavOsfolyiej5'; create database IF NOT EXISTS stdnotes ; grant all privileges on stdnotes.* to stdnotes@standardnotes.net.lgy.fr; cat << 'EOF' > /etc/standardnotes/api-gateway.env LOG_LEVEL=debug NODE_ENV=prod VERSION=prod PORT=3000 SYNCING_SERVER_JS_URL=http://localhost:3001 AUTH_SERVER_URL=http://localhost:3002 #PAYMENTS_SERVER_URL=http://payments:3000 HTTP_CALL_TIMEOUT=10000 AUTH_JWT_SECRET=BubohadtatyuhevGotsitvaijDikonoalyeldEerrEeHinyabEgyodridOudcecs # (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 EOF cat << 'EOF' > /etc/standardnotes/auth.env LOG_LEVEL=info NODE_ENV=prod VERSION=prod JWT_SECRET=BubohadtatyuhevGotsitvaijDikonoalyeldEerrEeHinyabEgyodridOudcecs LEGACY_JWT_SECRET=BubohadtatyuhevGotsitvaijDikonoalyeldEerrEeHinyabEgyodridOudcecs AUTH_JWT_SECRET=BubohadtatyuhevGotsitvaijDikonoalyeldEerrEeHinyabEgyodridOudcecs AUTH_JWT_TTL=60000 # Must be a hex string exactly 32 bytes long # e.g. feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308 ENCRYPTION_SERVER_KEY=6D447858586552317569573679393757696B4D3841736D686437774B4D6C5847 PORT=3002 DB_HOST=mysql.net.lgy.fr DB_REPLICA_HOST=mysql.net.lgy.fr DB_PORT=3306 DB_DATABASE=stdnotesauth DB_USERNAME=stdnotesauth DB_PASSWORD=OilOnotodfeOsyuItFijghorwodruefKojliNemVekekVogMamWiavOsfolyiej5 DB_DEBUG_LEVEL=info # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration" DB_MIGRATIONS_PATH=dist/migrations/*.js REDIS_URL=redis://localhost DISABLE_USER_REGISTRATION=false ACCESS_TOKEN_AGE=5184000 REFRESH_TOKEN_AGE=31556926 EPHEMERAL_SESSION_AGE=259200 MAX_LOGIN_ATTEMPTS=5 FAILED_LOGIN_LOCKOUT=3600 PSEUDO_KEY_PARAMS_KEY=gawquergabVatnumJorWeOgMyphevDaywitGhecAcyachHaykgeigJerreubNam 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:3001 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 # (Optional) Extensions Server EXTENSION_SERVER_URL= EOF cat << 'EOF' > /etc/standardnotes/syncing-server-js.env LOG_LEVEL=debug NODE_ENV=development VERSION=development AUTH_JWT_SECRET=BubohadtatyuhevGotsitvaijDikonoalyeldEerrEeHinyabEgyodridOudcecs PORT=3001 DB_HOST=mysql.net.lgy.fr DB_REPLICA_HOST=mysql.net.lgy.fr DB_PORT=3306 DB_DATABASE=stdnotes DB_USERNAME=stdnotes DB_PASSWORD=OilOnotodfeOsyuItFijghorwodruefKojliNemVekekVogMamWiavOsfolyiej5 DB_DEBUG_LEVEL=info # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration" DB_MIGRATIONS_PATH=dist/migrations/*.js REDIS_URL=redis://localhost 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:3002 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=debug EOF cat << 'EOF' > /etc/standardnotes/web.env RAILS_ENV=prod PORT=3004 WEB_CONCURRENCY=0 RAILS_LOG_TO_STDOUT=true # Log Level options: "INFO" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL" RAILS_LOG_LEVEL=INFO RAILS_SERVE_STATIC_FILES=true SECRET_KEY_BASE=test APP_HOST=https://notes.lgy.fr EXTENSIONS_MANAGER_LOCATION=extensions/extensions-manager/dist/index.html SF_DEFAULT_SERVER=https://api.notes.lgy.fr # Development options DEV_DEFAULT_SYNC_SERVER=https://api.notes.lgy.fr DEV_EXTENSIONS_MANAGER_LOCATION=public/extensions/extensions-manager/dist/index.html ENABLE_UNFINISHED_FEATURES=false DEV_WEBSOCKET_URL= # NewRelic (Optional) NEW_RELIC_ENABLED=false NEW_RELIC_THREAD_PROFILER_ENABLED=false NEW_RELIC_LICENSE_KEY= NEW_RELIC_APP_NAME=Web NEW_RELIC_BROWSER_MONITORING_AUTO_INSTRUMENT=false EOF cat << 'EOF' > /etc/systemd/system/standardnotes-web.service [Unit] Description=standardnote web Documentation=https://github.com/standardnotes/web After=network.target [Service] User=standardnotes Group=standardnotes EnvironmentFile=/etc/standardnotes/web.env WorkingDirectory=/usr/lib/standardnotes/web ExecStart=/usr/bin/npm run start Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF cat << 'EOF' > /etc/systemd/system/standardnotes-syncing-server-js.service [Unit] Description=standardnote syncing-server-js Documentation=https://github.com/standardnotes/syncing-server-js After=network.target [Service] User=standardnotes Group=standardnotes EnvironmentFile=/etc/standardnotes/syncing-server-js.env WorkingDirectory=/usr/lib/standardnotes/syncing-server-js ExecStart=/usr/bin/npm run start Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF cat << 'EOF' > /etc/systemd/system/standardnotes-syncing-server-js-worker.service [Unit] Description=standardnote syncing-server-js Documentation=https://github.com/standardnotes/syncing-server-js After=network.target [Service] User=standardnotes Group=standardnotes EnvironmentFile=/etc/standardnotes/syncing-server-js.env WorkingDirectory=/usr/lib/standardnotes/syncing-server-js ExecStart=/usr/bin/npm run worker Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF cat << 'EOF' > /etc/systemd/system/standardnotes-extention.service [Unit] Description=standardnote extention Documentation=https://github.com/standardnotes/extention After=network.target [Service] User=standardnotes Group=standardnotes WorkingDirectory=/usr/lib/standardnotes/extention/ ExecStart=http-server -p 8001 --cors -a Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF cat << 'EOF' > /etc/systemd/system/standardnotes-auth.service [Unit] Description=standardnote auth Documentation=https://github.com/standardnotes/auth After=network.target [Service] User=standardnotes Group=standardnotes EnvironmentFile=/etc/standardnotes/auth.env WorkingDirectory=/usr/lib/standardnotes/auth ExecStart=/usr/bin/npm run start Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF cat << 'EOF' > /etc/systemd/system/standardnotes-auth-worker.service [Unit] Description=standardnote auth Documentation=https://github.com/standardnotes/auth After=network.target [Service] User=standardnotes Group=standardnotes EnvironmentFile=/etc/standardnotes/auth.env WorkingDirectory=/usr/lib/standardnotes/auth ExecStart=/usr/bin/npm run worker Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF cat << 'EOF' > /etc/systemd/system/standardnotes-api-gateway.service [Unit] Description=standardnote api-gateway Documentation=https://github.com/standardnotes/api-gateway After=network.target [Service] User=standardnotes Group=standardnotes EnvironmentFile=/etc/standardnotes/api-gateway.env WorkingDirectory=/usr/lib/standardnotes/api-gateway ExecStart=/usr/bin/npm run start Restart=on-failure RestartSec=60 [Install] WantedBy=multi-user.target EOF systemctl enable standardnotes-api-gateway standardnotes-extention standardnotes-web standardnotes-auth standardnotes-syncing-server-js standardnotes-auth-worker standardnotes-syncing-server-js-worker --now
installation_de_standardnotes.1631264741.txt.gz · Dernière modification : 2021/09/10 11:05 de tomamplius