From e9badb4501263f76e57dc308563b409e83a398f9 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 6 Jun 2024 03:44:29 +0200 Subject: [PATCH] docs: Add Docker as a method to deploy --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8b7732a..8c830ed 100644 --- a/README.md +++ b/README.md @@ -68,24 +68,74 @@ API server for ReVanced. ## ❓ About ReVanced API is a server that is used as the backend for ReVanced. -ReVanced API acts as the data source for [ReVanced Website](https://github.com/ReVanced/revanced-website) and powers [ReVanced Manager](https://github.com/ReVanced/revanced-manager) with updates and ReVanced Patches. +ReVanced API acts as the data source for [ReVanced Website](https://github.com/ReVanced/revanced-website) and powers [ReVanced Manager](https://github.com/ReVanced/revanced-manager) +with updates and ReVanced Patches. ## đŸ’Ē Features Some of the features ReVanced API include: - đŸ“ĸ **Announcements**: Post and get announcements grouped by channels -- â„šī¸ **About**: Get more information such as a description, ways to donate to, and links of the hoster of ReVanced API +- â„šī¸ **About**: Get more information such as a description, ways to donate to, +and links of the hoster of ReVanced API - 🧩 **Patches**: Get the latest updates of ReVanced Patches, directly from ReVanced API - đŸ‘Ĩ **Contributors**: List all contributors involved in the project - 🔄 **Proxy**: A proxy to an old API for migration purposes and backwards compatibility ## 🚀 How to get started -1. Clone the repository -2. Set up the environment variables in a `.env` file using the `.env.example` file as a template -3. Configure the `configuration.toml` file using the `configuration.toml.example` file as a template -4. Run the server using `gradlew run --args=start` +ReVanced API can be deployed as a Docker container or used standalone. + +## đŸŗ Docker + +To deploy ReVanced API as a Docker container, you can use Docker Compose or Docker CLI. +The Docker image is published on GitHub Container registry, +so before you can pull the image, you need to [authenticate to the Container registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry). + +### đŸ—„ī¸ Docker Compose + +1. Create an `.env` file using [.env.example](.env.example) as a template +2. Create a `configuration.toml` file using [configuration.example.toml](configuration.example.toml) as a template +3. Create a `docker-compose.yml` file using [docker-compose.example.yml](docker-compose.example.yml) as a template +4. Run `docker-compose up -d` to start the server + +### đŸŗ Docker CLI + +1. Create an `.env` file using [.env.example](.env.example) as a template +2. Create a `configuration.toml` file using [configuration.example.toml](configuration.example.toml) as a template +3. Start the container using the following command: + + ```shell + docker run -d --name revanced-api \ + # Mount the .env file + -v $(pwd)/.env:/app/.env \ + # Mount the configuration.toml file + -v $(pwd)/configuration.toml:/app/configuration.toml \ + # Mount the persistence folder + -v $(pwd)/persistence:/app/persistence \ + # Expose the port 8888 + -p 8888:8888 \ + ghcr.io/revanced/revanced-api:latest + ``` + +## đŸ–Ĩī¸ Standalone + +To deploy ReVanced API standalone, you can either use the pre-built executable or build it from source. + +### đŸ“Ļ Pre-built executable + +1. [Download](https://github.com/ReVanced/revanced-patches/releases/latest) ReVanced API to a folder +2. In the same folder, create an `.env` file using [.env.example](.env.example) as a template +3. In the same folder, create a `configuration.toml` file +using [configuration.example.toml](configuration.example.toml) as a template +4. Run `java -jar revanced-api.jar start` to start the server + +### đŸ› ī¸ From source + +1. Run `git clone git@github.com:ReVanced/revanced-api.git` to clone the repository +2. Copy [.env.example](.env.example) to `.env` and fill in the required values +3. Copy [configuration.example.toml](configuration.example.toml) to `configuration.toml` and fill in the required values +4. Run `gradlew run --args=start` to start the server ## 📚 Everything else @@ -95,14 +145,15 @@ Thank you for considering contributing to ReVanced API. You can find the contrib ### đŸ› ī¸ Building -In order to build ReVanced API, follow these steps: +In order to build ReVanced API, Java Development Kit (JDK) and Git must be installed first. +Follow the steps below to build ReVanced API: -1. Clone the repository +1. Run `git clone git@github.com:ReVanced/revanced-api.git` to clone the repository 2. Run `gradlew build` to build the project ## 📜 Licence -ReVanced API is licensed under the GPLv3 licence. Please see the [licence file](LICENSE) for more information. -[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and +ReVanced API is licensed under the AGPLv3 licence. Please see the [licence file](LICENSE) for more information. +[tl;dr](https://www.tldrlegal.com/license/gnu-affero-general-public-license-v3-agpl-3-0) you may copy, distribute and modify ReVanced API as long as you track changes/dates in source files. Any modifications to ReVanced API must also be made available under the GPL along with build & install instructions.