# Notes
https://theselfhostingblog.com/posts/how-to-completely-self-host-standard-notes/#
# Add SSL certificate for webserver
Certbot for SSL certificate, using Let's Encrypt. This is horribly straightforward, plus it ran so ridiculously smoothly... nice.
``` sudo apt install certbot sudo apt install python3-certbot-nginx sudo certbot --nginx ```
To read soon: http://nginx.org/en/docs/beginners_guide.html
For webpages,
``` sudo apt install python3-pip sudo apt install python3-sphinx ```
Copied most of content from old server to new one.
For password authentication,
``` sudo apt install apache2-utils sudo htpasswd -c /etc/apache2/.htpasswd user2 # -c to create new file
location /restricted {
auth_basic "Restricted access"; auth_basic_user_file /etc/apache2/.htpasswd;
}
location /offlimits {
deny all; return 404;
} ```
Add git server: tbc. Need to manage keys which can be a hassle. Need to fix permissions on the server as well.
---
# Add Docker to Ubuntu
Docker:
``` # https://stackoverflow.com/questions/45023363/ # what-is-docker-io-in-relation-to-docker-ce-and-docker-ee sudo apt install docker.io
# To bypass permission issues sudo usermod -aG docker <USER> # Relogin to apply 'docker' group permissions
# Hello world docker run hello-world
# Install Docker Compose sudo apt install docker-compose ```
Find out disk space: `apt install ncdu` Check permissions: `ls -l`
Issues with git clone, turns out is clock time off. Use the `ntp` package with `apt install ntp`. Or not. Can still change timezone:
``` date -R # see datetime timedatectl list-timezones # see all available timezones sudo timedatectl set-timezone Asia/Singapore ```
Need to allow read access to CA certificates:
``` sudo chmod 755 /etc/ssl sudo chmod 755 /etc/ssl/certs/ca-certificates.crt sudo chmod 710 /etc/ssl/private
# Set source of CA certs git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt ```
# Create Standard Notes server
Back to standard notes. With my current setup, only supports up to "3.7" for Docker. So gotta change it:
``` git clone https://github.com/standardnotes/syncing-server.git vim syncing-server/docker-compose.yml ```
Takes a while, seems like it installs mariaDb, and uses Ruby at the moment. The current disk space taken up so far is 230 MiB...
Can consider hosting the web interface as well: https://github.com/standardnotes/web
Register through this: https://app.standardnotes.org/
Got this error:
``` Pulling db (mysql:5.6)... 5.6: Pulling from library/mysql ERROR: no matching manifest for linux/arm64/v8 in the manifest list entries ```
Need to start MySQL service:
``` sudo ufw allow mysql sudo systemctl start mysql sudo systemctl enable mysql # start upon reboot ```
This doesn't work = Docker was looking for manifest at library/mysql.
``` docker run --name=mysqlnotes -d -p 3306:3306 mysql/mysql-server:latest docker logs mysqlnotes 2>&1 | grep GENERATED # grab root pwd once healthy # [Entrypoint] GENERATED ROOT PASSWORD: @6w*U@=419oP+h#cjG43=kLTX.Hqf2S7
docker exec -it mysqlnotes mysql -uroot -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'localhostpw_d'; CREATE DATABASE standard_notes_db; CREATE USER 'std_notes_user'@'%' IDENTIFIED BY 'note_default_pwd'; exit
docker run -d -p 3000:3000 --net host --env-file=.env standardnotes/syncing-server ```
FINALLY, SUCCESS! The blocker was the requirement to use HTTPS for syncing server (or could also work over HTTP without an invalid cert). Syncing server is: https://sync.pyuxiang.com
Extensions: Followed the instructions here:
https://theselfhostingblog.com/posts/how-to-completely-self-host-standard-notes/
Sync with mobile is via desktop app, to configure settings directly on cloud.
The rest of the night was on exporting Evernote notes and migrating to Standard Notes. Conversion links: https://dashboard.standardnotes.org/tools
---
Raspberry Pi somehow terminated by docker containers with Error 255.
1. See all containers using the command: `sudo docker ps -a` 2. Kill the autostart SQL database using: `sudo service mysql stop`. Can verify service using `sudo netstat -nlpt |grep 3306` 3. Start the desired MySQL container: `sudo docker start a0dee`. Can verify database using `root@localhost:localhostpw_d` and `show databases;` or `select * from mysql.users`. 4. Start the SN server: `sudo docker start d8516b`. If still does not work, verify port forwarding to the Raspberry is up.