From 139ccd258045183658874229d1fa09466ddc8dbc Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Thu, 23 Feb 2023 02:28:47 -0500 Subject: [PATCH 1/6] docs: Add Docker install guide Based on Misskey's Docker guide: https://github.com/misskey-dev/misskey-hub/blob/main/src/en/docs/install/docker.md --- docs/install-docker.md | 70 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docs/install-docker.md diff --git a/docs/install-docker.md b/docs/install-docker.md new file mode 100644 index 000000000..91a95d59d --- /dev/null +++ b/docs/install-docker.md @@ -0,0 +1,70 @@ +# Create FoundKey instance with Docker Compose + +This guide describes how to install and setup FoundKey with Docker Compose. + +**WARNING:** +Never change the domain name (hostname) of an instance once you start using it! + + +## Requirements +- Docker or Podman +- Docker Compose plugin (or podman-compose) + +If using Podman, replace `docker` with `podman`. Commands using `docker compose` should be replaced with `podman-compose`. + +You may need to prefix `docker` commands with `sudo` unless your user is in the `docker` group or you are running Docker in rootless mode. + +## Get the repository +```sh +git clone https://akkoma.dev/FoundKeyGang/FoundKey.git +cd FoundKey +``` + +##Configure + +Copy example configuration files with following: + +```sh +cp .config/docker_example.yml .config/default.yml +cp .config/docker_example.env .config/docker.env +cp ./docker-compose.yml.example ./docker-compose.yml +``` + +Edit `default.yml` and `docker.env` according to the instructions in the files. + +Edit `docker-compose.yml` if necessary. (e.g. if you want to change the port). + +## Build and initialize +The following command will build FoundKey and initialize the database. +This will take some time. + +``` shell +docker compose build +docker compose run --rm web pnpm run init +``` + +## Launch +You can start FoundKey with the following command: + +```sh +docker compose up -d +``` + +## How to update your FoundKey server +When updating, be sure to check the [release notes](https://akkoma.dev/FoundKeyGang/FoundKey/src/branch/main/CHANGELOG.md) to know in advance the changes and whether or not additional work is required (in most cases, it is not). + +```sh +git stash +git checkout master +git pull +git stash pop +docker compose build +docker compose stop && docker compose up -d +``` + +It may take some time depending on the contents of the update and the size of the database. + +## How to execute CLI commands +```sh +docker compose run --rm web node packages/backend/built/tools/foo bar +``` From ecbe984315dec4048798b412f9a13489e7cf6758 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Thu, 23 Feb 2023 15:05:06 -0500 Subject: [PATCH 2/6] Add suggestions from @EpicKitty --- docs/install-docker.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/install-docker.md b/docs/install-docker.md index 91a95d59d..39aeba710 100644 --- a/docs/install-docker.md +++ b/docs/install-docker.md @@ -20,7 +20,7 @@ git clone https://akkoma.dev/FoundKeyGang/FoundKey.git cd FoundKey ``` -##Configure +## Configure Copy example configuration files with following: @@ -31,6 +31,8 @@ cp ./docker-compose.yml.example ./docker-compose.yml ``` Edit `default.yml` and `docker.env` according to the instructions in the files. +You will need to set the database host to `db` and Redis host to `redis` in order to use the internal container network for these services. + Edit `docker-compose.yml` if necessary. (e.g. if you want to change the port). @@ -40,7 +42,7 @@ This will take some time. ``` shell docker compose build -docker compose run --rm web pnpm run init +docker compose run --rm web yarn run init ``` ## Launch @@ -50,6 +52,8 @@ You can start FoundKey with the following command: docker compose up -d ``` +In case you are encountering issues, you can run `docker compose logs -f` to get the log output of the running containers. + ## How to update your FoundKey server When updating, be sure to check the [release notes](https://akkoma.dev/FoundKeyGang/FoundKey/src/branch/main/CHANGELOG.md) to know in advance the changes and whether or not additional work is required (in most cases, it is not). From b046718d1d5c393fb082f7c0b8b902a268f2f7dc Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Fri, 24 Feb 2023 11:21:26 -0500 Subject: [PATCH 3/6] Use `docker compose down` instead of `stop` --- docs/install-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install-docker.md b/docs/install-docker.md index 39aeba710..575ba4906 100644 --- a/docs/install-docker.md +++ b/docs/install-docker.md @@ -63,7 +63,7 @@ git checkout master git pull git stash pop docker compose build -docker compose stop && docker compose up -d +docker compose down && docker compose up -d ``` It may take some time depending on the contents of the update and the size of the database. From 5ffcb9f2352700a46d27503b6f23f3f663c0aa1c Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Fri, 24 Feb 2023 11:23:52 -0500 Subject: [PATCH 4/6] remove docker-compose.yml.example command --- docs/install-docker.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/install-docker.md b/docs/install-docker.md index 575ba4906..9588df3d0 100644 --- a/docs/install-docker.md +++ b/docs/install-docker.md @@ -27,7 +27,6 @@ Copy example configuration files with following: ```sh cp .config/docker_example.yml .config/default.yml cp .config/docker_example.env .config/docker.env -cp ./docker-compose.yml.example ./docker-compose.yml ``` Edit `default.yml` and `docker.env` according to the instructions in the files. From 5662635d454a058495cf2a0ef2ba84949ed37246 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Wed, 22 Mar 2023 18:34:15 -0400 Subject: [PATCH 5/6] Update branch checked out to "main" --- docs/install-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/install-docker.md b/docs/install-docker.md index 9588df3d0..1e88454d9 100644 --- a/docs/install-docker.md +++ b/docs/install-docker.md @@ -58,7 +58,7 @@ When updating, be sure to check the [release notes](https://akkoma.dev/FoundKeyG ```sh git stash -git checkout master +git checkout main git pull git stash pop docker compose build From 9b7dcb4262ef118d5c15c6d147ce101027e6f2ac Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Sat, 25 Mar 2023 01:42:33 -0400 Subject: [PATCH 6/6] Update instructions to match changes in da246ce41956301d21a0590e5810fd4688f65cb7 --- docs/install-docker.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/install-docker.md b/docs/install-docker.md index 1e88454d9..6e9d14b92 100644 --- a/docs/install-docker.md +++ b/docs/install-docker.md @@ -20,6 +20,12 @@ git clone https://akkoma.dev/FoundKeyGang/FoundKey.git cd FoundKey ``` +To make it easier to perform your own changes on top, we suggest making a branch based on the latest tag. +In this example, we'll use `v13.0.0-preview1` as the tag to check out and `my-branch` as the branch name. +```sh +git checkout tags/v13.0.0-preview1 -b my-branch +``` + ## Configure Copy example configuration files with following: @@ -56,11 +62,15 @@ In case you are encountering issues, you can run `docker compose logs -f` to get ## How to update your FoundKey server When updating, be sure to check the [release notes](https://akkoma.dev/FoundKeyGang/FoundKey/src/branch/main/CHANGELOG.md) to know in advance the changes and whether or not additional work is required (in most cases, it is not). +To update your branch to the latest tag (in this example `v13.0.0-preview2`), you can do the following: ```sh -git stash -git checkout main -git pull -git stash pop +git fetch -t + +# Use --squash if you want to merge all of the changes in the tag into a single commit. +# Useful if you have made additional changes. +git merge tags/v13.0.0-preview2 + +# Rebuild and restart the docker container. docker compose build docker compose down && docker compose up -d ```