change dir structure, add docs, download by git

This commit is contained in:
老周部落 2024-03-04 17:09:59 +08:00
parent 218a875b8b
commit ab1c674fb8
No known key found for this signature in database
GPG key ID: C72181CD85C6B738
9 changed files with 54 additions and 40 deletions

View file

@ -0,0 +1,13 @@
## Containerized Database Environment
The Firefish repo comes with containerized database environment to help make development!
## Prerequisites
- 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).
## Start up the environment
1. Run `git clone https://firefish.dev/firefish/firefish.git && cd firefish` to fetch needed files.
1. Using the scripts located in scripts folder to make the development environment running.

28
dev/docker/README.md Normal file
View file

@ -0,0 +1,28 @@
# Containerized Environment
The Firefish repo comes with a new containerized environment to help make development!
## Prerequisites
- 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
- 3030
- 25432
- 26379
## Start up the environment
1. Download the [`dev/docker` directory](https://firefish.dev/firefish/firefish/-/tree/develop/dev/docker) and execute `chmod +x docker-entrypoint.sh`.
- Alternatively, you can manually run `git clone https://firefish.dev/firefish/firefish.git && cd firefish` to fetch needed files, or let the script take care of itself.
1. Open `docker-compose.yml` and set `URL` to the URL you want to use (or leave it to `http://localhost:3030`).
1. Run `docker compose up`. This will build the environment, dependencies and prepare the needed config files.
- If you use Podman, you should run `podman-compose up` instead.
1. Wait until the following message shows up.
```
DONE * [core boot] All workers started
DONE * [core boot] Now listening on port 3030 on https://your_firefish_url.example.com
```
1. A fresh Firefish environment is created on the URL you have set!
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.

View file

@ -8,24 +8,25 @@ if [ ! -f '/.firefish_env_initialized' ]; then
# Install compilation dependencies
apt-get update
DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends curl build-essential ca-certificates python3 postgresql-client-15
DEBIAN_FRONTEND='noninteractive' apt-get install -y --no-install-recommends curl build-essential ca-certificates python3 postgresql-client-15 git
curl -vvv --proto '=https' --tlsv1.2 --show-error --fail https://sh.rustup.rs | sh -s -- -y
# Add Cargo PATH
PATH="/root/.cargo/bin:${PATH}"
# If Firefish not exist
if [ ! -f '/firefish/README.md' ]; then
# Download Firefish and decompress
curl -vvv -O --proto '=https' --tlsv1.2 --show-error --fail https://firefish.dev/firefish/firefish/-/archive/develop/firefish-develop.tar.bz2
tar -xjvf firefish-develop.tar.bz2 --strip-components 1 -C /firefish
# Clone Firefish
cd /
git clone -v https://firefish.dev/firefish/firefish.git
# Configuring a new server
cd /firefish
cp .config/devenv.yml .config/default.yml
URL="$(echo "${URL}" | sed 's#/#\\/#g')"
sed -i'.bak' "s/http:\/\/localhost:3030/${URL}/" .config/default.yml
sed -i'.bak' "s/http:\/\/localhost:3030/${URL}/" .config/default.yml
fi

View file

@ -1,30 +1,11 @@
# Firefish Developer Docs
We support multiple methods to build a development environment, and you can choose the method you like.
## Containerized Environment
The Firefish repo comes with a new containerized environment to help make development!
You can find documentation at [Here](../dev/docker/README.md).
### Prerequisites
## Containerized Database Environment
- 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
- 3030
- 25432
- 26379
### Start up the environment
1. Download the [`dev` directory](https://firefish.dev/firefish/firefish/-/tree/develop/dev) and execute `chmod +x dev/docker-entrypoint.sh`.
- Alternatively, you can just run `git clone https://firefish.dev/firefish/firefish.git && cd firefish` to fetch needed files (it clones the entire repository, though).
1. Open `dev/docker-compose.yml` and set `URL` to the URL you want to use (or leave it to `http://localhost:3030`).
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 3030 on https://your_firefish_url.example.com
```
1. A fresh Firefish environment is created on the URL you have set!
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.
You can find documentation at [Here](../dev/docker-dbonly/README.md).

View file

@ -5,11 +5,7 @@ import { execa } from "execa";
(async () => {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
execa("podman-compose", [
"--file",
"docker-compose-dbonly.yml",
"down",
], {
execa("podman-compose", {
cwd: join(__dirname, "/../dev"),
stdio: "inherit",
});

View file

@ -5,12 +5,7 @@ import { execa } from "execa";
(async () => {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
execa("podman-compose", [
"--file",
"docker-compose-dbonly.yml",
"up",
"--detach",
], {
execa("podman-compose", {
cwd: join(__dirname, "/../dev"),
stdio: "inherit",
});