firefish/dev/docs/db-container.md
naskya dff0cb799c
docs: update documents and config files
Co-authored-by: sup39 <dev@sup39.dev>
2024-03-19 00:21:02 +09:00

2.2 KiB

Set up database containers and run Firefish locally

Prerequisites

You can refer to local-installation.md to install the dependencies.

Configure the environment

  1. Fork the Firefish repository on GitLab
  2. Clone your Firefish repository
    git clone https://firefish.dev/your-user-name/firefish.git
    cd firefish
    
  3. Create .config/default.yml with the following content
    # You can change the port if 3000 is already used
    url: http://localhost:3000
    port: 3000
    
    db:
      host: localhost
      port: 25432
      db: firefish_db
      user: firefish
      pass: password
    
    redis:
      host: localhost
      port: 26379
    
    logLevel: [
      'error',
      'success',
      'warning',
      'info'
    ]
    
  4. Start database containers
    cd dev/db-container
    docker compose up --detach
    # or podman-compose up --detach
    # or whatever
    
    # go back to the repository root
    cd ../..
    

Build and start Firefish

  1. Build Firefish
    pnpm install
    pnpm run build:debug
    
  2. Execute database migrations
    pnpm run migrate
    
  3. Start Firefish
    pnpm run start
    
    You can access to the local Firefish server on http://localhost:3000 after this message shows up!
    DONE *  [core boot]     All workers started
    DONE *  [core boot]     Now listening on port 3000 on http://localhost:3000
    

Reset the environment

You can recreate a fresh local Firefish environment by recreating the database containers:

cd dev/db-container
docker compose down
docker compose up --detach
cd ../..

pnpm run migrate
pnpm run start