🔗 Installation ⤴️
-
SSH into your server.
-
Install Go. Make sure $(go env GOPATH)/bin/
is in your $PATH.
-
Install Git.
-
go install -tags fts5 github.com/bokwoon95/notebrew/notebrew@latest
-
Make sure notebrew
prints something. If you see something like "-bash: notebrew: command not found" it means installation failed.
🔗 Connect by IP address ⤴️
-
To connect to notebrew by your server's IP address, you need to make notebrew listen on port 80.
-
Run notebrew status
. It should show your current port.
$ notebrew status
❌ notebrew is not currently running on port 6444
port = 6444
cmsdomain = localhost:6444
contentdomain = localhost:6444
cdndomain = <not configured>
imgcmd = <not configured>
maxminddb = <not configured>
database = <not configured>
files = /root/notebrew-files
captcha = <not configured>
smtp = <not configured>
proxy = <not configured>
To configure notebrew's settings, run `notebrew config`.
- Run
notebrew config port
. It should show your current port configuration (likely blank).
$ notebrew config port
- Run
notebrew config port 80
to set the port to 80. Then, check the output of notebrew config port
. It should now show "80". notebrew status
should also show port 80, as well as the server's IP address.
$ notebrew config port 80
$ notebrew config port
80
$ notebrew status
❌ notebrew is not currently running on port 80
port = 80
cmsdomain = xxx.xxx.xxx.xxx
contentdomain = xxx.xxx.xxx.xxx
cdndomain = <not configured>
imgcmd = <not configured>
maxminddb = <not configured>
database = <not configured>
files = /root/notebrew-files
captcha = <not configured>
smtp = <not configured>
proxy = <not configured>
dns = <not configured>
certmagic = /root/t/certmagic
IPv4 = xxx.xxx.xxx.xxx
IPv6 = xxxx:xxxx:xxxx:xxxx::xxxx
domains =
managing =
To configure notebrew's settings, run `notebrew config`.
- Run
notebrew
, then visit the IP address via a web browser and see if you can connect to the server.
$ notebrew
notebrew is running on http://xxx.xxx.xxx.xxx/files/
🔗 Enable user accounts ⤴️
- Run
notebrew config database
to check the current database dialect. If the dialect is empty, the database is not enabled and user accounts will not be enabled.
$ notebrew config database
# == database keys == #
# Refer to `notebrew config` on how to get and set config values.
# dialect - Database dialect (possible values: sqlite, postgres, mysql).
# filePath - File path to the sqlite file (if dialect is sqlite).
# user - Database user.
# password - Database password.
# host - Database host.
# port - Database port.
# dbName - Database name.
# params - Database-specific connection parameters (see https://example.com for more info).
# maxOpenConns - Max open connections to the database (0 means unset, default is unlimited).
# maxIdleConns - Max idle connections to the database (0 means unset, default is 2).
# connMaxLifetime - Connection max lifetime. e.g. 5m, 10m30s
# connMaxIdleTime - Connection max idle time. e.g. 5m, 10m30s
{
"dialect": "",
"filePath": "",
"user": "",
"password": "",
"host": "",
"port": "",
"dbName": "",
"params": {},
"maxOpenConns": 0,
"maxIdleConns": 0,
"connMaxLifetime": "",
"connMaxIdleTime": ""
}
- Run
notebrew config database.dialect sqlite
to set the database dialect to sqlite.
$ notebrew config database.dialect sqlite
-
Run notebrew createuser
and follow the instructions to create a new user. Leave the username blank to create the default user. For the default user, you will log in using the email instead.
-
Restart the notebrew server and visit the IP address again e.g. http://xxx.xxx.xxx.xxx/files/, this time you should be prompted to log in. Log in using the credentials of the default user you entered earlier.
-
If you forget your password, you can always run notebrew resetpassword
to try again.
🔗 Configuring your domain name ⤴️
-
Configure a DNS A or AAAA record at your domain registrar by pointing it at your server's IP address (use notebrew status
to check your server's IP address).
-
Make sure that your domain name correctly resolves to your server's IP address (using a DNS checker like https://dnschecker.org). It may take some time for your domain name to become associated with the server's IP address, please be patient.
-
Restart the notebrew server and visit your domain name this time, seeing if you can connect to your server via domain name.
🔗 Configuring HTTPS ⤴️
-
Once you've confirmed that you can talk to your server using your domain name, you can enable HTTPS by running notebrew config port 443
to set the port to 443. Use notebrew status
to check that the port has indeed been set to 443.
-
Restart the notebrew server again, this time it should prompt you to enter your email and some other details in order to use the LetsEncrypt certificates. Once entered, notebrew will take some time to provision the certificates (synchronously). This may or may not fail several times, if it fails just rerun notebrew
again to retry the certificate provisioning process.
-
When the certificate process is complete, you should see "notebrew is running on :443". Try visiting your domain name, this time using HTTPS.
🔗 Run Notebrew in the background ⤴️
-
When all the above steps are complete, it's time to run notebrew in the background. If you know how to use systemd or tmux you can ignore this step.
-
Up until now, the instructions have been to run notebrew
in order to start the server. However, the moment you disconnect from your SSH session the server stops. Remedy this by running notebrew start
instead, which starts the server and does not stop even when the SSH session ends. Later when you SSH into the server again, you can stop this process by running notebrew stop
. Use notebrew status
to check whether or not the server is running.
🔗 Change filesystem provider from directory to database (recommended) ⤴️
-
By default, notebrew uses a local directory for its filesystem provider. If you are self-hosting, it is recommended to use a database-backed filesystem instead. The benefits of a database filesystem are:
To show your current filesystem provider, run notebrew config files
.
$ notebrew config files
# == files keys == #
# Choose between using a directory, database or sftp filesystem to store files.
# Refer to `notebrew config` on how to get and set config values.
# provider - Files provider (possible values: directory, database, sftp).
# authenticationMethod - Authentication method for connecting to SFTP server (possible values: password, publickey).
# tempDir - Temporary directory to store files in while they are being written (if using a directory or sftp).
# dialect - Database dialect (possible values: sqlite, postgres, mysql).
# filePath - Files root directory (if using a directory) or file path to the sqlite file (if using sqlite database) or remote root directory (if using SFTP).
# user - Database/SFTP user.
# password - Database/SFTP password.
# host - Database/SFTP host.
# port - Database/SFTP port.
# dbName - Database name.
# params - Database-specific connection parameters (see https://example.com for more info).
# maxOpenConns - Max open connections to the database/SFTP server (0 means unset, default is unlimited for the database and 1 for the SFTP server).
# maxIdleConns - Max idle connections to the database (0 means unset, default is 2).
# connMaxLifetime - Connection max lifetime. e.g. 5m, 10m30s (database only).
# connMaxIdleTime - Connection max idle time. e.g. 5m, 10m30s (database only).
{
"provider": "",
"authenticationMethod": "",
"tempDir": "",
"dialect": "",
"filePath": "",
"user": "",
"password": "",
"host": "",
"port": "",
"dbName": "",
"params": {},
"maxOpenConns": 0,
"maxIdleConns": 0,
"connMaxLifetime": "",
"connMaxIdleTime": "",
"followers": [],
"synchronousReplication": false
}
To set the database provider to database, run notebrew config files.provider database
$ notebrew config files.provider database
Run notebrew config files
again to check that the files provider has been set to "database". Restart the notebrew server.