Skip to content

Commit

Permalink
Release 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rishikanthc committed Sep 27, 2024
1 parent 667ef02 commit 5004a00
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 150 deletions.
37 changes: 31 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
FROM alpine:latest
FROM node:22.9.0-alpine3.20

ARG PB_VERSION=0.22.21
ARG [email protected]
ARG POCKETBASE_ADMIN_PASSWORD=admin123

RUN apk add --no-cache \
ARG POCKETBASE_URL=http://127.0.0.1:8080
ARG TITLE=Markopolis
ARG API_KEY=test
ARG CAP1=none
ARG CAP2=none
ARG CAP3=none

# Set environment variables to be overridden at runtime
ENV PB_VERSION=${PB_VERSION}
ENV POCKETBASE_ADMIN_EMAIL=${POCKETBASE_ADMIN_EMAIL}
ENV POCKETBASE_ADMIN_PASSWORD=${POCKETBASE_ADMIN_PASSWORD}
ENV POCKETBASE_URL=${POCKETBASE_URL}
ENV TITLE=${TITLE}
ENV API_KEY=${API_KEY}
ENV CAP1=${CAP1}
ENV CAP2=${CAP2}
ENV CAP3=${CAP3}

# Install required packages
RUN apk update && apk add --no-cache \
unzip \
ca-certificates \
curl

# download and unzip PocketBase
Expand All @@ -26,7 +43,15 @@ RUN chmod +x /pb/start.sh
# uncomment to copy the local pb_hooks dir into the image
# COPY ./pb_hooks /pb/pb_hooks

EXPOSE 8080
WORKDIR /app
COPY . .
COPY start_services.sh /app/start.sh

RUN npm ci

RUN /pb/start.sh

EXPOSE 3000 8080

# start PocketBase
CMD ["/pb/start.sh"]
CMD ["/bin/sh", "/app/start.sh"]
150 changes: 79 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@ open-source and free under the MIT License. Check out the [GitHub repo](https://
**TLDR:** Self-hosted Obsidian publish with an API to extend functionality.

## Features
- **Simple Deployment:** Extremely easy to deploy, configure, and use.
- **REST API Interface:** Provides a REST API to interact with different Markdown elements in your notes.
- **Customizable UI:** Supports "bring your own user interface" by using Markopolis as a backend.
- **Obsidian Markdown Flavor:** Stays close to the Obsidian Markdown flavor and supports backlinks, todos, LaTeX equations, code, tables, callouts etc.
- **Instant Rendering:** Uses a single command to push Markdown notes to the server and instantly renders them as simple webpages.
- **Full Text Search:** Implements full text search.
- **Dark and Light Modes:** Supports both dark and light modes.
- **Low Maintenance:** Requires very little to no maintenance.
- **Docker Support:** Comes as a deployable Docker image.
- **API Documentation:** Inbuilt API documentation generated using FastAPI.

- **Easy setup** Extremely simple to deploy and use
- **Easy publish** Publish notes online with a single command
- **Markdown API interface** Interact with aspecs of markdown using REST APIs
- **Extensible** Extendable using exposed APIs
- **Develop your own frontend** You can use the api calls to get every section of markdown files to design your own frontend
- **Instand rendering** Article is available online as soon as ypu publish
- **Full text search** Fuzzy search across your entire notes vault
- **Obsidian markdown flavor** Maintains compatibility with obsidian markdown syntax. Supports
callouts, equations, code highlighting etc.
- **Dark & Light modes** Supports toggling between light and dark themes
- **Easy maintenance** Requires very little to no maintenance
- **Docker support** Available as docker images to self host

and lots more to come. Checkout the [roadmap](https://markopolis.app/roadmap) page for planned features.

## Demo
The documentation [website](https://markopolis.app) is hosted using Markopolis and showcases a small collection of Markdown notes to highlight the essential features.
I have tried to incorporate content here to showcase different features. Take a look at the [https://markopolis.app/](https://markopolis.app/Markdown%20Syntax) page for
checking out how different markdown syntax is rendered.
The documentation [website](https://markopolis.app) is hosted using Markopolis and is a live demo.
These notes are used to demonstrate the various aspects of Markopolis.
Checkout the [[Markdown Syntax]] page for a full showcase of all supported markdown syntax. checking out how different markdown syntax is rendered.

Thank you for considering Markopolis for your Markdown note-sharing needs! If you like
the project considering starring the repository.
Expand All @@ -47,58 +50,77 @@ will always be open-source and maintained as I rely on it for my own notes syste
If you like the project please don't forget to star the [github repo](https://github.com/rishikanthc/markopolis.git).

## Installation
Installing Markopolis involves two steps.

- **STEP 1:** Deploying the Markopolis server
- **STEP 2:** Installing the Markopolis package on your local machine
Installing Markopolis involves two steps. First deploying the server. Second
installing the CLI tool. The CLI tool provides a utility command to upload
your markdown files to the server. The articles are published as soon as
this command is run.

## STEP 1: Deploying Markopolis server
## Server installation

The easiest way to deploy the server is to use the provided docker image.
The docker image packages both the backend and frontend together and sets up a
reverse proxy to route requests correctly to the backend and frontend.
We will be using Docker for deploying Markopolis.
Create a docker-compose and configure environment variables.
Make sure to generate and add a secure `API_KEY`.
Allocate persistent storage for the Markdown files.

You can use the docker-compose provided below. Make sure to change the
environment variables to match your settings.

> [!warning]
> Make sure to use a secure API key. You can use `openssl rand -hex 32` to
> generate a random alphanumeric string to use as your API key.

### Docker Compose
Next create a `docker-compose.yaml` file with the following:


```
```yaml
version: '3.8'

services:
markopolis:
image: ghcr.io/rishikanthc/markopolis:2.0.0
image: ghcr.io/rishikanthc/markopolis:latest
ports:
- "8080:80"
- "8080:8080"
- "3000:3000"
environment:
- MARKOPOLIS_DOMAIN="https://your-domain.com"
- MARKOPOLIS_FRONTEND_URL = https://your-domain.com"
- MARKOPOLIS_TITLE="Awesome Notes"
- MARKOPOLIS_MD_PATH=/app/markdown
- MARKOPOLIS_API_KEY=<really long random alpha-numeric string>
- POCKETBASE_URL=http://127.0.0.1:8080
- API_KEY=test
- [email protected]
- POCKETBASE_ADMIN_PASSWORD=password
- TITLE=Markopolis
- CAP1=caption1
- CAP2=caption2
- CAP3=caption3
volumes:
- markopolis_data:/app/markdown
restart: unless-stopped
volumes:
markopolis_data:
driver: local
- ./pb_data:/app/pb
```
Now you can deploy Markopolis by running `docker-compse up -d`

Parameter | Description
-- | --
MARKOPOLIS_DOMAIN | This is the domain at which both your frontend and backend is available by default. Make sure to include the protocol along with your domain
MARKOPOLIS_FRONTEND_URL | This parameter is available for configuring custom frontend implementations. If you are using the default front-end that ships with Markopolis, this should be **same as MARKOPOLIS_DOMAIN**.
MARKOPOLIS_TITLE | This parameter controls the site title displayed on the top-left in the header
MARKOPOLIS_MD_PATH | This is the path on the server at which your markdown files are stored. Ideally this should point to a directory in your persistent volume.
MARKOPOLIS_API_KEY | For security, most of the API endpoints are protected by an API key. Make sure to use a secure API key and don't share it publicly.
POCKETBASE_URL | **DO NOT Change this**
POCKETBASE_ADMIN_EMAIL | The admin account email for the database
POCKETBASE_ADMIN_PASSWORD | The admin account password
TITLE | SITE TITLE
API_KEY | For security, most of the API endpoints are protected by an API key. Make sure to use a secure API key and don't share it publicly.
CAP1 | Caption 1, text that appears below the site title
CAP2 | Caption 2
CAP3 | Caption 3


## Local Installation
Requirements: Python 3.12

Install:
```sh
pip install markopolis
```

### Configuration:
Create a config file as a YAML file in any location.
Set the `MARKOPOLIS_CONFIG_PATH` environment variable to point to the location of the config file.
The config file should specify the domain of the deployment including the protocol and
the api key. The api key should be the same as what you used for the deployment:

```yaml
domain: "https://your-domain.com"
```

I recommend using a python virtual environment for the local installation.


> [!warning]
> the domains should not contain a leading slash at the end.
Expand All @@ -107,23 +129,18 @@ MARKOPOLIS_API_KEY | For security, most of the API endpoints are protected by an

## STEP 2: Local installation

Markopolis provides an easy way to sync or push your markdown files from your computer to the server.
You do not need to use Docker to mount your markdown files. Follow the instructions below to set this
up.


I highly recommend configuring a virtual environment for python to keep your environment clean and
and prevent any dependency issues. Below I detail the steps to do this using Conda or pip. If you are familar
with this feel free to skip to the package installation section.

> [!info]
> You need to have python version >= 3.11
> You need to have python version >= 3.12

### Setting up a virtual environment

You can use either `pip` or `conda` to do this. If you are using `pip` simply run
```bash
python3.11 -m venv <name>
python3.12 -m venv <name>
```

Replace `<name>` with your desired virtual environment name. You can then activate the virtual environment
Expand All @@ -134,7 +151,7 @@ source <name>

For conda, you can use
```bash
conda create -n <name> python==3.11
conda create -n <name> python==3.12
```

and activate it with
Expand All @@ -153,40 +170,31 @@ pip install markopolis

### Configuration

Create a yaml config file anywhere in your system to set the below values. I recommend
storing it in `.config/markopolis/settings.yaml`.

> [!info]
> You can name the file anything and you can store it anywhere.
> You will need to set the config path for Markopolis to read the config file correctly.
Point markopolis to your config file by setting the `MARKOPOLIS_CONFIG_PATH` to the location
of your yaml file. You can also add it to your shell config so it persists across sessions.

Set the environment variables `MARKOPOLIS_DOMAIN` and `MARKOPOLIS_API`

**bash or zsh (temporarily for current session)**
```bash
export MARKOPOLIS_CONFIG_PATH=/path/to/settings.yaml
export MARKOPOLIS_DOMAIN=https://markopolis.example.com
```

**bash or zsh (permanently for all sessions)**
```bash
echo 'export MARKOPOLIS_CONFIG_PATH=/path/to/settings.yaml' >> ~/.zshrc
echo 'export MARKOPOLIS_CONFIG_PATH=/path/to/settings.yaml' >> ~/.bashrc
echo 'export MARKOPOLIS_DOMAIN=https://markopolis.example.com' >> ~/.zshrc
echo 'export MARKOPOLIS_DOMAIN=https://markopolis.example.com' >> ~/.bashrc
source ~/.zshrc
source ~/.bashrc
```

**fish (temporarily for current session)**
```fish
set -x MARKOPOLIS_CONFIG_PATH /path/to/settings.yaml
set -x MARKOPOLIS_DOMAIN https://markopolis.example.com
```


**fish (permanently for all sessions)**
```fish
echo 'set -x MARKOPOLIS_CONFIG_PATH "/path/to/settings.yaml"' >> ~/.config/fish/config.fish
echo 'set -x MARKOPOLIS_DOMAIN "https://markopolis.example.com"' >> ~/.config/fish/config.fish
source ~/.config/fish/config.fish
```

Expand Down
20 changes: 12 additions & 8 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
version: '3.8'

services:
sveltekit-pocketbase:
image: local-sveltekit-pocketbase:test
markopolis:
image: ghcr.io/rishikanthc/markopolis:3.0.0
ports:
- "8080:8080"
- "3000:3000"
environment:
- POCKETBASE_URL=http://localhost:8080
- API_KEY=compose-runtime-key
- [email protected]
- POCKETBASE_ADMIN_PASSWORD=123
- TITLE=Compose Runtime App
- POCKETBASE_URL=http://127.0.0.1:8080
- API_KEY=test
- [email protected]
- POCKETBASE_ADMIN_PASSWORD=password
- TITLE=Markopolis
- CAP1=Markdown
- CAP2="Self-hosted"
- CAP3="Knowledge Garden"
volumes:
- ./pb_data:/app/pb_data
- ./pb_data:/app/pb
19 changes: 10 additions & 9 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@ TITLE=Markopolis
Next create a `docker-compose.yaml` file with the following:
```yaml
version: '3.8'
services:
markopolis:
image: ghcr.io/rishikanthc/markopolis:0.2.0
sveltekit-pocketbase:
image: ghcr.io/rishikanthc/markopolis:latest
ports:
- "8090:8090" # optional
- "8080:8080"
- "3000:3000"
env_file:
.env
environment:
- API_KEY=<long random string>
- [email protected]
- POCKETBASE_URL=http://127.0.0.1:8080
- API_KEY=test
- [email protected]
- POCKETBASE_ADMIN_PASSWORD=password
- TITLE=Markopolis
volumes:
- markopolis_data:/app/db
restart: unless-stopped
- ./pb_data:/app/pb
```
Now you can deploy Markopolis by running `docker-compse up -d`
Expand Down
Loading

0 comments on commit 5004a00

Please sign in to comment.