From 421d51b34dc09e2058243b5a928015963f11417d Mon Sep 17 00:00:00 2001 From: naskya <m@naskya.net> Date: Mon, 4 Mar 2024 01:35:31 +0900 Subject: [PATCH] chore (dev): update docs about containerized environment --- dev/docker-entrypoint.sh | 10 +++++----- docs/development.md | 36 +++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/dev/docker-entrypoint.sh b/dev/docker-entrypoint.sh index 5d083cf728..1b278c18ec 100755 --- a/dev/docker-entrypoint.sh +++ b/dev/docker-entrypoint.sh @@ -3,6 +3,8 @@ set -xeu node --version +FIREFISH_URL='http://localhost:3000' + # Check Environment Initialized Flag if [ ! -f '/.firefish_env_initialized' ]; then @@ -24,11 +26,9 @@ if [ ! -f '/.firefish_env_initialized' ]; then cd /firefish cp .config/devenv.yml .config/default.yml - if [ -n "${URL-}" ]; then - URL="$(echo "${URL}" | sed 's#/#\\/#g')" - sed -i'.bak' "s/http:\/\/localhost:3000/${URL}/g" .config/default.yml - rm .config/defaut.yml.bak - fi + URL="$(echo "${FIREFISH_URL}" | sed 's#/#\\/#g')" + sed -i'.bak' "s/http:\/\/localhost:3000/${URL}/g" .config/default.yml + rm .config/defaut.yml.bak fi diff --git a/docs/development.md b/docs/development.md index f55a817f1e..e9e1e1abd3 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,24 +1,30 @@ # Firefish Developer Docs -## Docker-based Environment +## Containerized Environment -The Firefish repo comes with a new Docker-based environment to help make development as easy as possible! +The Firefish repo comes with a new containerized environment to help make development! ### Prerequisites -- Installed [Docker](https://docs.docker.com/get-docker/) (use the comman on their website) . -- If your Docker version is older, you may also need to manually install Docker Compose, and in the following instructions -`docker compose` should be replaced with `docker-compose` . -- It is necessary to confirm that port 3000, 25432 and 26379 are not used by other programs or services. +- Latest [Docker](https://docs.docker.com/get-docker/) installation + - Alternatively, you can use [Podman](https://podman.io/docs/installation) and [Podman Compose](https://github.com/containers/podman-compose). +- The following ports are not in use + - 3000 + - 25432 + - 26379 -Once Docker is installed to your computer, follow these next few steps to running: +### Start up the environment -- Download `docker-compose.yml` and `docker-entrypoint.sh` in dev folder to the new folder on your computer. -- If you are not running on your PC, open `docker-compose.yml`, set `URL` and save. -- Run `chmod 777 docker-entrypoint.sh`, for initialization script can be execute. -- Run `docker compose up`, This will build the environment, dependencies and prepare the needed config files. -- Once you see the Firefish banner printed in your screen, means initialization finished. -- Open http://localhost:3000 or `URL` on `docker-compose.yml` in your web browser. -- You should now see the admin user creation screen! +1. Run `git clone https://firefish.dev/firefish/firefish.git && cd firefish` to fetch needed files. + - If you don't want to clone the entire repository, you can just download the [`dev` directory](https://firefish.dev/firefish/firefish/-/tree/develop/dev) and execute `chmod +x dev/docker-entrypoint.sh`. +1. Open `dev/docker-compose.yml` and set `FIREFISH_URL` to the URL you want to use (or leave it to `http://localhost:3000`). +1. Run `docker compose --file dev/docker-compose.yml up`. This will build the environment, dependencies and prepare the needed config files. + - If you use Podman, you should run `podman-compose --file dev/docker-compose.yml up` instead. +1. Wait until the following message shows up. + ``` + DONE * [core boot] All workers started + DONE * [core boot] Now listening on port 3000 on https://your_firefish_url.example.com + ``` +1. A fresh Firefish environment is created on the URL you have set! -Note: When you want to restart a dev server, all you need to do is press `Ctrl+C` and run `docker compose up`, no other steps are necessary. +When you want to restart the dev server, you just need to terminate the process (a.k.a. press `Ctrl+C`) and run `docker compose up` again.