Skip to content

Install & Run instructions

hakan edited this page Apr 25, 2021 · 6 revisions

Install

Via pip

screen
pip install pervane
pervane --dir=example/

When you go to localhost:5000, you need to register. Pervane only accepts 1 user. So your notes will only be visible by this single user. ⚠️ If you see a server error, delete your cookies and retry.

Package details here: https://pypi.org/project/pervane/

Via Docker

The following command starts pervane in a container on port=5000 with the host network. You can see it at localhost:5000 on your browser.

docker run --network host pervane/pervane

Via source

  • Clone the repo to somewhere in your machine.
  • Run it in screen or tmux.
# Run it in screen to make it always run.
screen

# Download the latest version.
git clone https://github.com/hakanu/pervane.git
cd pervane/pervane
python3 serve.py --dir=example/

Update

The tool is still under heavy development, I update the package in pypi multiple times per week. It would be great if you keep updating pervane.

Via pip

pip install --upgrade pervane

Via Docker

The latest pervane/pervane image on Docker Hub contains the most recent pervane version which existed at the build time of the image. If a new pervane version is published after you pull the latest image, when you run a container, the container will internally update pervane before starting it. However, when you stop the container and run another one, it will repeat the update step. A warning is printed to remind you to pull the new latest image from Docker Hub again so that you can use the image that contains the new pervane version.

Options

  • --dir: Note root directory. File tree will be generated from this. If PERVANE_HOME environment variable is set and --dir is not provided, PERVANE_HOME is used.
  • --host: defaults to 0.0.0.0. Hostname to be binded. If PERVANE_HOST environment variable is set and --host is not provided, PERVANE_HOST is used.
  • --port: defaults to 5000. Port number to be binded. If PERVANE_PORT environment variable is set and --port is not provided, PERVANE_PORT is used.
  • --config_dir. defaults to $HOME/.pervane. Directory to keep internal files of pervane. If PERVANE_CONFIG_HOME environment variable is set and --config_dir is not provided, PERVANE_CONFIG_HOME is used.
  • --username: DEPRECATED. Authentication is now based on cookie based login. Username for basic http auth. defaults to 'hakuna'.
  • --password: DEPRECATED. Authentication is now based on cookie based login. Username for basic http auth. defaults to 'matata'.
  • --front_page_message: / message.
  • --cache_seconds: Seconds to bust the cache. Mainly used for file tree re-reading.
  • --debug: Enable more verbose logging. If PERVANE_DEBUG environment variable is set and --debug is not provided, PERVANE_DEBUG is used.
  • --version: Show version.

Mount local config and note directories while using with Docker

The following command mounts /home/basri/notes and /home/basri/.pervane to the container. You can run pervane with the user and note data on your host. Make sure to change the host directories to your own setup.

docker run \
--rm --network host \
--mount type=bind,source=/home/basri/notes,target=/pervane-notes \
--mount type=bind,source=/home/basri/.pervane,target=/pervane-config \
pervane/pervane --dir=/pervane-notes --config_dir=/pervane-config

You can do the same with environment variables as follows:

docker run \
--rm --network host \
-e PERVANE_HOME=/pervane-notes -e PERVANE_CONFIG_HOME=/pervane-config \
--mount type=bind,source=/home/basri/notes,target=/pervane-notes \
--mount type=bind,source=/home/basri/.pervane,target=/pervane-config \
pervane/pervane

PERVANE_HOME and PERVANE_CONFIG_HOME point to /var/opt/pervane and /etc/opt/pervane by default. You can mount your host directories to their default values as below:

docker run \
--rm --network host \
--mount type=bind,source=/home/basri/notes,target=/var/opt/pervane \
--mount type=bind,source=/home/basri/.pervane,target=/etc/opt/pervane \
pervane/pervane