chore (dev): update docs about containerized environment

This commit is contained in:
naskya 2024-03-04 01:35:31 +09:00
parent 90a33b2371
commit 421d51b34d
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
2 changed files with 26 additions and 20 deletions

View file

@ -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

View file

@ -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.