Skip to content

Commit

Permalink
feat: Add bin/install.sh script to configure and install server with …
Browse files Browse the repository at this point in the history
…docker. Fix Minio IP address for connection from client
  • Loading branch information
uniuuu committed Nov 12, 2024
1 parent 9749699 commit d68521b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 19 deletions.
7 changes: 2 additions & 5 deletions .env_example
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,6 +15,3 @@ MINIOROOTPASSWORD=zoterodocker
#Version
VER=v2.8.0

# Ip/host of the Minio.
S3HOST=10.5.5.1:9000

16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://\<Server IP Address\>: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:

Expand Down
33 changes: 33 additions & 0 deletions bin/install.sh
Original file line number Diff line number Diff line change
@@ -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

4 changes: 2 additions & 2 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d68521b

Please sign in to comment.