diff --git a/Dockerfile b/Dockerfile index b6381e9..baa3851 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,29 @@ -FROM alpine:latest +FROM node:22.9.0-alpine3.20 ARG PB_VERSION=0.22.21 ARG POCKETBASE_ADMIN_EMAIL=admin@example.com 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 @@ -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"] diff --git a/README.md b/README.md index bef881a..68d5928 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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= + - POCKETBASE_URL=http://127.0.0.1:8080 + - API_KEY=test + - POCKETBASE_ADMIN_EMAIL=admin@admin.com + - 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. @@ -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 +python3.12 -m venv ``` Replace `` with your desired virtual environment name. You can then activate the virtual environment @@ -134,7 +151,7 @@ source For conda, you can use ```bash -conda create -n python==3.11 +conda create -n python==3.12 ``` and activate it with @@ -153,26 +170,17 @@ 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 @@ -180,13 +188,13 @@ 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 ``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 9e4f89b..b4c51e4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 - - POCKETBASE_ADMIN_EMAIL=admin@example.com - - POCKETBASE_ADMIN_PASSWORD=123 - - TITLE=Compose Runtime App + - POCKETBASE_URL=http://127.0.0.1:8080 + - API_KEY=test + - POCKETBASE_ADMIN_EMAIL=admin@admin.com + - POCKETBASE_ADMIN_PASSWORD=password + - TITLE=Markopolis + - CAP1=Markdown + - CAP2="Self-hosted" + - CAP3="Knowledge Garden" volumes: - - ./pb_data:/app/pb_data + - ./pb_data:/app/pb diff --git a/docs/installation.md b/docs/installation.md index 8b46891..f880087 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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= - - POCKETBASE_ADMIN_EMAIL=example@example.com + - POCKETBASE_URL=http://127.0.0.1:8080 + - API_KEY=test + - POCKETBASE_ADMIN_EMAIL=admin@admin.com - 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` diff --git a/docs/todo.md b/docs/todo.md deleted file mode 100644 index fcda0f3..0000000 --- a/docs/todo.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: Project todos -date: 09-23-2024 -tags: - - todo ---- -This document provides a comprehensive guide to the structure and content of the Marco Plus documentation. It includes sections on installation, usage, markdown syntax, changelog, development plans, and developer references. The document also outlines action items for further development and documentation tasks. -## Documentation Structure -### Introduction -- **Purpose**: The introduction will cover the project's aim and functionality. -- **Features**: A list of features will be included. -- **Call to Action**: Request for stars on GitHub. -- **Navigation**: Links to installation and usage pages. -### Installation -- **Deployment**: Instructions on deploying Marco Plus using Docker. -- **CLI Installation**: Steps to install the Python package for the CLI interface. -### Usage -- **Library Setup**: Guidance on setting up the library. -- **Document Upload**: Instructions on uploading markdown documents to the server. -- **Known Issues**: Mention any caveats or known issues. -- **Markdown Syntax Reference**: Link to the Markdown Syntax page. -### Markdown Syntax -- **Formatting Examples**: Showcase different Markdown Syntax formatting. -- **Marco Plus Formatting**: Demonstrate how it's formatted in Marco Plus. -### Changelog -- **Release Notes**: Each file will describe changes made in that release. - - **Breaking Changes**: Clearly mention any breaking changes. - - **Bug Fixes**: List of bugs that have been fixed. - - **New Features**: Features added in the release. -### Development Plan -- **Planned Features**: List of all currently planned features. -- **Progress Tracking**: - - **Current Work**: Features or tasks currently being worked on. - - **Next Steps**: What is next in the pipeline. -### Developer Reference -#### Architecture -- **Framework Interaction**: Explanation of how different components interact. -#### Backend -- **Markdown Parsing**: Details on markdown parsing. -- **APIs**: Separate page for APIs. -- **Database Schema**: Documentation of the database schema. -#### Frontend -- **Layout Documentation**: How the front-end is arranged and laid out. -## Action Items -- [ ] Create an introduction page with project overview and GitHub link. -- [ ] Develop installation instructions for Docker and CLI. -- [ ] Draft usage guidelines including setup and known issues. -- [ ] Compile a Markdown Syntax reference page. -- [ ] Organize changelog files for each release. -- [ ] Outline the development plan with current and future tasks. -- [ ] Document the architecture and backend components. -- [ ] Prepare frontend layout documentation. diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte index fb40fd2..e3480fb 100644 --- a/src/lib/components/Sidebar.svelte +++ b/src/lib/components/Sidebar.svelte @@ -7,6 +7,7 @@ import { Button } from '$lib/components/ui/button/index.js'; export let title; + export let captions;
@@ -14,8 +15,8 @@ {title}
-
Machine Learning / Self-Hosting
-
Technology /
+
{captions[0]} / {captions[1]}
+
{captions[2]}