TranslateProject/sources/tech/20180801 Getting started with Standard Notes for encrypted note-taking.md

7.1 KiB
Raw Blame History

Getting started with Standard Notes for encrypted note-taking

Standard Notes is a simple, encrypted notes app that aims to make dealing with your notes the easiest thing you'll do all day. When you sign up for a free sync account, your notes are automatically encrypted and seamlessly synced with all your devices.

There are two key factors that differentiate Standard Notes from other, commercial software solutions:

  1. The server and client are both completely open source.
  2. The company is built on sustainable business practices and focuses on product development.

When you combine open source with ethical business practices, you get a software product that has the potential to serve you for decades. You start to feel ownership in the product rather than feeling like just another transaction for an IPO-bound company.

In this article, Ill describe how to deploy your own Standard Notes open source syncing server on a Linux machine. Youll then be able to use your server with our published applications for Linux, Windows, Android, Mac, iOS, and the web.

If you dont want to host your own server and are ready to start using Standard Notes right away, you can use our public syncing server. Simply head on over to Standard Notes to get started.

Hosting your own Standard Notes server

Get the Standard File Rails app running on your Linux box and expose it via NGINX or any other web server.

Getting started

These instructions are based on setting up our syncing server on a fresh CentOS-like installation. You can use a hosting service like AWS or DigitalOcean to launch your server, or even run it locally on your own machine.

  1. Update your system:
     sudo yum update

  1. Install RVM (Ruby Version Manager):
    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    \curl -sSL https://get.rvm.io | bash -s stable

  1. Begin using RVM in current session:
    source /home/ec2-user/.rvm/scripts/rvm

  1. Install Ruby:
     rvm install ruby

This should install the latest version of Ruby (2.3 at the time of this writing.)

Note that at least Ruby 2.2.2 is required for Rails 5.

  1. Use Ruby:
     rvm use ruby

  1. Install Bundler:
   gem install bundler --no-ri --no-rdoc

  1. Install mysql-devel:
     sudo yum install mysql-devel

  1. Install MySQL (optional; you can also use a hosted db through Amazon RDS, which is recommended):
    sudo yum install mysql56-server

    sudo service mysqld start

    sudo mysql_secure_installation

    sudo chkconfig mysqld on

Create a database:

    mysql -u root -p

    > create database standard_file;

    > quit;

  1. Install Passenger:
    sudo yum install rubygems

    gem install rubygems-update --no-rdoc --no-ri

    update_rubygems

    gem install passenger --no-rdoc --no-ri

  1. Remove system NGINX installation if installed (youll use Passengers instead):
    sudo yum remove nginx
    sudo rm -rf /etc/nginx
  1. Configure Passenger:
    sudo chmod o+x "/home/ec2-user"

    sudo yum install libcurl-devel

    rvmsudo passenger-install-nginx-module

    rvmsudo passenger-config validate-install

  1. Install Git:
    sudo yum install git

  1. Set up HTTPS/SSL for your server (free using Let'sEncrypt; required if using the secure client on https://app.standardnotes.org):
    sudo chown ec2-user /opt

    cd /opt

    git clone https://github.com/letsencrypt/letsencrypt

    cd letsencrypt

Run the setup wizard:

    ./letsencrypt-auto certonly --standalone --debug

Note the location of the certificates, typically /etc/letsencrypt/live/domain.com/fullchain.pem

  1. Configure NGINX:
    sudo vim /opt/nginx/conf/nginx.conf

Add this to the bottom of the file, inside the last curly brace:

    server {

        listen 443 ssl default_server;

        ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;

        ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;

        server_name domain.com;

        passenger_enabled on;

        passenger_app_env production;

        root /home/ec2-user/ruby-server/public;

      }

  1. Make sure you are in your home directory and clone the Standard File ruby-server project:
    cd ~

    git clone https://github.com/standardfile/ruby-server.git

    cd ruby-server

  1. Set up project:
    bundle install

    bower install

    rails assets:precompile

  1. Create a .env file for your environment variables. The Rails app will automatically load these when it starts.
    vim .env

Insert:

    RAILS_ENV=production

    SECRET_KEY_BASE=use "bundle exec rake secret"



    DB_HOST=localhost

    DB_PORT=3306

    DB_DATABASE=standard_file

    DB_USERNAME=root

    DB_PASSWORD=

  1. Setup database:
    rails db:migrate

  1. Start NGINX:
    sudo /opt/nginx/sbin/nginx

Tip: you will need to restart NGINX whenever you make changes to your environment variables or the NGINX configuration:

    sudo /opt/nginx/sbin/nginx -s reload

  1. Youre done!

Using your new server

Now that you have your server running, you can plug it into any of the Standard Notes applications and sign into it.

On the Standard Notes web or desktop app:

Click Account, then Register. Choose "Advanced Options" and youll see a field for Sync Server. Enter your servers URL here.

On the Standard Notes Android or iOS app:

Open the Settings window, click "Advanced Options" when signing in or registering, and enter your server URL in the Sync Server field.

For help or questions with your Standard Notes server, join our Slack group in the #dev channel, or visit our help page for frequently asked questions and other topics.


via: https://opensource.com/article/18/8/getting-started-standard-notes

作者:Mo Bitar 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出