]> Untitled Git - lemmy.git/blob - install.sh
Merge branch 'nutomic-multiple-instances' into dev
[lemmy.git] / install.sh
1 #!/bin/bash
2 set -e
3
4 # Set the database variable to the default first.
5 # Don't forget to change this string to your actual database parameters
6 # if you don't plan to initialize the database in this script.
7 export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
8
9 # Set other environment variables
10 export JWT_SECRET=changeme
11 export HOSTNAME=rrr
12
13 # Optionally initialize the database
14 init_db_valid=0
15 init_db_final=0
16 while [ "$init_db_valid" == 0 ]
17 do
18   read -p "Initialize database (y/n)? " init_db
19   case "${init_db,,}" in
20     y|yes ) init_db_valid=1; init_db_final=1;;
21     n|no ) init_db_valid=1; init_db_final=0;;
22     * ) echo "Invalid input" 1>&2;;
23   esac
24   echo
25 done
26 if [ "$init_db_final" = 1 ]
27 then
28   source ./server/db-init.sh
29   read -n 1 -s -r -p "Press ANY KEY to continue execution of this script, press CTRL+C to quit..."
30   echo
31 fi
32
33 # Build the web client
34 cd ui
35 yarn
36 yarn build
37
38 # Build and run the backend
39 cd ../server
40 RUST_LOG=debug cargo run
41
42 # For live coding, where both the front and back end, automagically reload on any save, do:
43 # cd ui && yarn start
44 # cd server && cargo watch -x run