Skip to main content

Plant-it

Create a folder and cd into it.

Create backend.env

backend.env
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_USERNAME=root
MYSQL_PSW=root
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=bootdb

JWT_SECRET=32characterscomplicatedkey
JWT_EXP=1

USERS_LIMIT=2 # including the admin account, so <= 0 if undefined, >= 2 if defined
UPLOAD_DIR=/upload-dir
API_PORT=8080

CACHE_TTL=86400
CACHE_HOST=cache
CACHE_PORT=6379

TRAFLE_KEY=your key from https://trefle.io/

ALLOWED_ORIGINS=*

Create frontend.env

frontend.env
PORT=3000
API_URL=http://hostIPadress:8089/api
WAIT_TIMEOUT=5000

PAGE_SIZE=25

BROWSER=none

Create docker-compose.yml

version: "3"

name: plant-it
services:
  backend:
    image: msdeluise/plant-it-backend:latest
    env_file: backend.env
    depends_on:
      - db
      - cache
    restart: unless-stopped
    volumes:
      - "/srv/Files/path/Plant-it/upload-dir:/upload-dir"
    ports:
      - "8089:8080" #match with frontend

  db:
    image: mysql:8.0
    restart: always
    env_file: backend.env
    volumes:
      - "/srv/Files/path/Plant-it/db:/var/lib/mysql"

  cache:
    image: redis:7.2.1
    restart: always

  frontend:
    image: msdeluise/plant-it-frontend:latest
    env_file: frontend.env
    links:
      - backend
    ports:
      - "3009:3000" #match with backend

Run docker-compose up -d

Change port binding

Backend

If you don't want to use the default port 8080, you can follow these steps:

  • change the port binding in the docker-compose.yml file, e.g. 9090:8080 to setup the port 9090 for the backend service
  • update the API_URL (frontend.env file) variable in order to points to the correct backend address
Frontend

If you don't want to use the default port 3000, you can follow these steps:

  • change the port binding in the docker-compose.yml file, e.g. 4040:3000 to setup the port 4040 for the frontend service