diff --git a/.env_example b/.env_example index 067b1727..ade114c3 100644 --- a/.env_example +++ b/.env_example @@ -1,5 +1,5 @@ -# IP/host of the Dataserver. -DSHOST=http://localhost:8080/ +# IP address of the Dataserver. +HOST=http://127.0.0.1:8080/ ## SECRETS #DB @@ -15,6 +15,3 @@ MINIOROOTPASSWORD=zoterodocker #Version VER=v2.8.0 -# Ip/host of the Minio. -S3HOST=10.5.5.1:9000 - diff --git a/README.md b/README.md index 478b0787..c35d6698 100644 --- a/README.md +++ b/README.md @@ -28,23 +28,19 @@ $ mkdir /path/to/your/app && cd /path/to/your/app $ git clone -b production --recursive --single-branch https://github.com/uniuuu/zotprime.git $ cd zotprime ``` -*Configure*: -```bash -$ cp .env_example .env -``` -**Edit .env and change DSHOST.** -``` -DSHOST=http://\:8080/ -``` + +### Start server. *Run*: ```bash -$ sudo docker compose up -d +$ ./bin/install.sh ``` +*Configure*: +**When prompted input the IP address of the server** + ### Initialize databases *Initialize databases*: ```bash $ ./bin/init.sh -$ cd .. ``` ### Available endpoints: diff --git a/bin/install.sh b/bin/install.sh new file mode 100755 index 00000000..98b69e11 --- /dev/null +++ b/bin/install.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +# HOST=127.0.0.1 + +cp .env_example .env + +echo -n "Enter the IP address of the server. Leave empty for default 127.0.0.1 : " +read HOST + +echo -n "Note in case IP address has a typo then edit manually .env file to correct it" +echo +read -p "Are you sure you want to continue? " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]] +then + case $HOST in + "") SERVER=127.0.0.1 ;; + *) SERVER=$HOST ;; + esac + echo "Server IP address is set to $SERVER" + sed -i "s#http://127.0.0.1:8080/#http://$SERVER:8080/#g" .env + +fi + +if ! test -f ./docker-compose.yml; then + cp docker-compose-prod.yml docker-compose.yml +fi + + +sudo docker compose up -d + diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 29deba44..e95dba25 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -163,8 +163,8 @@ services: environment: - RUN_USER=apache - RUN_GROUP=apache - - DSURI=${DSHOST} - - S3POINTURI=${S3HOST} + - DSURI=${HOST} + - S3POINTURI=${HOST} depends_on: - zotprime-db - zotprime-elasticsearch diff --git a/docker-compose-prod.yml b/docker-compose-prod.yml index cb83d063..e10ca291 100644 --- a/docker-compose-prod.yml +++ b/docker-compose-prod.yml @@ -82,8 +82,8 @@ services: environment: - RUN_USER=apache - RUN_GROUP=apache - - DSURI=${DSHOST} - - S3POINTURI=${S3HOST} + - DSURI=${HOST} + - S3POINTURI=${HOST} depends_on: - zotprime-db - zotprime-elasticsearch