Standard Notes 安装

安装Standard File server

  • 导入GPG Keys
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
  • 安装RVM
curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
  • 安装ruby
rvm install ruby
  • 启用ruby
rvm use ruby
  • 安装bundler
gem install bundler --no-document
  • 更改RubyGems
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
bundle config mirror.https://rubygems.org https://gems.ruby-china.com
  • Passenger
gem install passenger
  • MySQL开发包
yum install mysql-devel
  • 拉代码、初始化
git clone https://github.com/standardfile/ruby-server.git
cd ruby-server

bundle install
bower install
rails assets:precompile
  • 创建.env,修改下面的内容
RAILS_ENV=production
SECRET_KEY_BASE=[运行"bundle exec rake secret",然后填入值]

DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=standard_file
DB_USERNAME=root
DB_PASSWORD=

SALT_PSEUDO_NONCE=[运行"bundle exec rake secret",然后填入值]
  • 初始化DB
rake db:migrate RAILS_ENV=production
  • 启动服务
passenger start --daemonize -e production --address 127.0.0.1 --port 12345
  • 配置Caddy
https://note.example.com {
	gzip
	tls /etc/ssl/caddy/note.example.com.crt /etc/ssl/caddy/private.key {
		curves p521 p384 X25519 p256
	}

	header / {
		X-Content-Type-Options nosniff
		X-Frame-Options "SAMEORIGIN"
		X-XSS-Protection "1; mode=block"
		X-Robots-Tag none
		X-Download-Options noopen
		X-Permitted-Cross-Domain-Policies none
		Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
	}

	proxy / 127.0.0.1:12345 {
		transparent
	}
}
  • 启动Caddy
/usr/local/bin/caddy -conf /etc/caddy/Caddyfile -quic &
  • 编辑/etc/rc.local,添加Passenger到自启动
cd /path/to/standardnote && passenger start --daemonize -e production --address 127.0.0.1 --port 12345

Standard Notes连接到自建服务器

  • 启动Standard Notes,先点击Register,选Advanced Options,里面填上上面的服务器地址https://note.example.com
  • done