diff options
| author | lonkaars <loek@pipeframe.xyz> | 2021-04-25 11:23:18 +0200 | 
|---|---|---|
| committer | lonkaars <loek@pipeframe.xyz> | 2021-04-25 11:23:18 +0200 | 
| commit | 5244fab8678f1d3226efca8139695e89e6e0c23b (patch) | |
| tree | 664615da39329d35b8e33516e6aa5317a509c7a5 | |
| parent | ee5479c1c4bd992e108623e32cabb375512a57a2 (diff) | |
moved to new config script with more options
| -rwxr-xr-x | config | 75 | ||||
| -rwxr-xr-x | configure | 22 | ||||
| -rw-r--r-- | readme.md | 36 | 
3 files changed, 89 insertions, 44 deletions
| @@ -0,0 +1,75 @@ +#!/bin/sh + +export $(cat .env | xargs) + +packages() { +	sudo apt-get install \ +		nodejs npm \ +		python3 python3-venv python3-pip \ +		make \ +		gcc \ +		sqlite3 libsqlite3-dev \ +		nginx +} + +yarn_install() { +	sudo npm i -g typescript yarn # install typescript compilers and yarn package manager globally using npm +} + +node_packages() { +	yarn +} + +python_packages() { +	python3 -m venv venv # create virtual environment +	venv/bin/pip install -r requirements.txt # install the dependencies +} + +submodules() { +	git submodule init +	git submodule update +} + +database() { +	cd database +	sh init_db.sh +	make +	cd .. +} + +voerbak() { +	cd voerbak +	make +	cd .. +} + +customize_config() { +	sed "s/{{ connect4_dir }}/${CONNECT4_WEB_ROOT}/g" -i ./api.systemd.conf +	sed "s/{{ connect4_user }}/$(whoami)/g" -i ./api.systemd.conf +	sed "s/user nobody/user $(whoami)/" -i ./nginx.conf +} + +build() { +	customize_config +	npx next build +	npx next export +	mv out $CONNECT4_WEB_ROOT +} + +all() { +	packages +	yarn_install +	node_packages +	python_packages +	submodules +	database +	voerbak +} + +if [[ -z $1 ]]; then +	all +	exit +fi + +$1 + diff --git a/configure b/configure deleted file mode 100755 index 624c2df..0000000 --- a/configure +++ /dev/null @@ -1,22 +0,0 @@ -sudo apt-get install nodejs npm python3 python3-venv python3-pip make gcc sqlite3 libsqlite3-dev nginx - -sudo npm i -g typescript yarn -yarn - -python3 -m venv venv -source venv/bin/activate -pip install -r requirements.txt - -git submodule init -git submodule update - -cd database -sh init_db.sh -make -cd .. - -cd voerbak -make -cd .. - -sed "s/user nobody/user $(whoami)/" -i ./nginx.conf @@ -62,16 +62,16 @@ git submodules and compile voerbak and the sql extensions.  > I haven't figured out how to run this project on Windows, so please install  > [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10) if you want  > to run this yourself on Windows. The distro you choose doesn't matter, though -> package names in ./configure may vary if your distro doesn't use the apt -> package manager. +> package names in ./config may vary if your distro doesn't use the apt package +> manager. -### automatic setup using `./configure` (debian/ubuntu) +### automatic setup using `./config` (debian/ubuntu)  This script might also work on other distro's using the `apt` package manager.  To start the setup process you only need to run the following command:  ```sh -./configure +./config  ```  The script calls sudo and apt install so some password input/manual confirmation @@ -89,37 +89,31 @@ project by following these steps:     installed.  3. Make sure you have [nginx](https://nginx.org/en/) installed.  4. Make sure you have [make](https://www.gnu.org/software/make/) and the gnu c -   compilers [gcc](https://gcc.gnu.org/) installed (most distro's will have +   compilers ([gcc](https://gcc.gnu.org/)) installed (most distro's will have     these by default). -5. Install typescript, react-scripts and yarn: +5. Install typescript and yarn:     ```sh -   npm i -g typescript yarn +   ./config yarn_install     ```  6. Create a new python virtual environment and install pip modules:     ```sh -   python -m venv venv -   source venv/bin/activate -   pip install -r requirements.txt +   ./config python_packages     ```  7. Install node modules:     ```sh -   yarn +   ./config node_packages     ```  8. Build voerbak:     ```sh -   cd voerbak -   make +   ./config voerbak     ```  9. Download submodules:     ```sh -   git submodule init -   git submodule update +   ./config submodules     ```  10. Initialize database and build SQL extensions:      ```sh -    cd database -    ./init_db.sh -    make +    ./config database      ```  ## How to start @@ -129,8 +123,7 @@ flask server, react server, and nginx seperately:  ```sh  # term 1 -source venv/bin/activate -python3 api/main.py +venv/bin/python3 api/main.py  # term 2  yarn dev @@ -139,6 +132,5 @@ yarn dev  sudo nginx -c $PWD/nginx.conf  # if nginx can't run as the user nobody, try running the following command and restart nginx: -# this command is also in ./configure -sed "s/user nobody/user $(whoami)/" -i nginx.conf +./config customize_config  ``` |