Standard Notes is a secure, open-source note-taking application designed with privacy and simplicity in mind. It allows users to self-host their own instance, ensuring complete control over their data while offering extensive customization options. In this guide, weβll explore the essential steps to deploy, configure, and manage a self-hosted Standard Notes server, covering installation, reverse proxy configuration, logging, backups, updates, and leveraging its unique features.
Installing Standard Notes
π¦ Docker/Docker Compose Setup
Using Docker Compose is one of the easiest ways to deploy Standard Notes. Below is a docker-compose.yml
file to set up a self-hosted instance of the Standard Notes sync server.
version: '3.8'
services:
standardnotes:
image: standardnotes/self-hosted:latest
container_name: standardnotes
restart: unless-stopped
ports:
- "3000:3000" # Map port 3000 for external access
environment:
- NODE_ENV=production
- SERVER_URL=https://yourdomain.com # Replace with your domain
- DB_HOST=mysql # Database hostname
- DB_PORT=3306 # Database port
- DB_USER=standardnotes # Database username
- DB_PASSWORD=yourpassword # Database password
- DB_DATABASE=standardnotes # Database name
- REDIS_HOST=redis # Redis hostname
- REDIS_PORT=6379 # Redis port
depends_on:
- mysql
- redis
volumes:
- ./data:/data # Persist data locally
mysql:
image: mysql:8.0
container_name: mysql
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=yourrootpassword
- MYSQL_DATABASE=standardnotes
- MYSQL_USER=standardnotes
- MYSQL_PASSWORD=yourpassword
volumes:
- ./mysql_data:/var/lib/mysql
redis:
image: redis:latest
container_name: redis
restart: unless-stopped
volumes:
- ./redis_data:/data
Deploy the stack with the following commands:
mkdir standardnotes && cd standardnotes
nano docker-compose.yml # Paste the above configuration
docker-compose up -d
π Manual Installation
For a manual installation on a Linux server, follow these steps:
- Install Node.js, MySQL, and Redis:
sudo apt update && sudo apt install -y nodejs npm mysql-server redis-server
- Clone Standard Notes from GitHub:
git clone https://github.com/standardnotes/syncing-server.git
cd syncing-server
- Install dependencies and build the app:
npm install
npm run build
- Configure environment variables:
cp .env.example .env
nano .env # Update your environment variables, such as DB credentials
- Start the server:
npm start
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
To serve Standard Notes via Nginx, create a server block file:
sudo nano /etc/nginx/sites-available/standardnotes
Add the following content:
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Enable the configuration and reload Nginx:
sudo ln -s /etc/nginx/sites-available/standardnotes /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure your site with Let's Encrypt:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
Automate certificate renewals:
sudo crontab -e
0 0 1 * * certbot renew --quiet
Logging and Debugging Standard Notes
ποΈ Enabling Debug Logs
Enable debug logging by updating the .env
file in your Standard Notes installation:
DEBUG=true
Restart the server to apply the changes:
docker-compose restart
## Or, for manual installation
npm start
π Viewing Logs
Access Standard Notes logs with the following commands:
- For Docker:
docker logs standardnotes
- For manual installations:
tail -f /path/to/your/logfile.log
π οΈ Troubleshooting Common Issues
Common issues, such as database connection errors, can often be identified in the server logs. Look for errors like:
Error: Cannot connect to the database
Verify that MySQL and Redis are running:
sudo systemctl status mysql
sudo systemctl status redis
Backup and Restore
ποΈ File-Based Backups
To back up data volumes (Docker), run:
tar -czvf standardnotes-backup.tar.gz ./data ./mysql_data ./redis_data
π Database Backups
Back up the MySQL database manually:
mysqldump -u standardnotes -pstandardnotes_password standardnotes > db_backup.sql
Restore the database:
mysql -u standardnotes -pstandardnotes_password standardnotes < db_backup.sql
π Automated Backup Scripts
Set up a cron job for periodic backups:
crontab -e
## Add the following line for daily backups
0 2 * * * tar -czvf /path/to/backups/standardnotes-$(date +\%F).tar.gz /path/to/data
Updating and Upgrading Standard Notes
β¬οΈ Updating Docker Images
Pull the latest Docker image and redeploy:
docker-compose pull
docker-compose down
docker-compose up -d
π οΈ Manual Updates
For manual installations, update the codebase and rebuild:
git pull origin main
npm install
npm run build
Restart the server:
npm start
Leveraging Standard Notesβs Unique Features
π§ Enabling APIs
Standard Notes supports APIs for sync and data management. To enable them, ensure your .env
file contains the correct SERVER_URL
and run the app. Use curl
to interact with the API:
curl -X POST https://yourdomain.com/items -H "Authorization: Bearer <token>"
π Advanced Configurations
To customize your installation, update the .env
file to enable features like email notifications or integrations, then restart the server.
Wrapping Up
This guide covered deploying and managing Standard Notes, from installation to backups, reverse proxies, and advanced configurations. By self-hosting Standard Notes, you gain full control over your data and can tailor the app to your needs. Start implementing the code examples above to harness the power of this secure and customizable note-taking solution.