Skip to content
Snippets Groups Projects
Commit 6aeb3f18 authored by Tuomas Mettaenen's avatar Tuomas Mettaenen
Browse files

Update README.md

parent 441de54d
Branches patch-1
No related tags found
1 merge request!4Update README.md
......@@ -106,7 +106,118 @@ conda env create -f environment.yaml
## BigDataServer
TODO
Description: Client -> Nginx proxy tcp/80 -> Java application tcp/8020
Start or stop the application
```
systemctl start/stop/restart bigdata-0.2.0
systemctl start/stop/restart nginx
```
Monitor logs
```
tail /var/log/bigdata.log /var/log/nginx/error.log
```
- Add user
```
useradd --shell /sbin/nologin bigdata
cat /etc/passwd |grep bigdata:
bigdata:x:1000:1000::/home/bigdata:/sbin/nologin
```
- Configure Nginx (/etc/nginx/conf.d/cbb-bigdatra01.conf)
```
server {
listen 80;
server_name cbb-bigdata01.embl.de;
location /0.2.0 {
proxy_pass http://cbb-bigdata01.embl.de:8020/0.2.0;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
location /0.2.1 {
proxy_pass http://cbb-bigdata01.embl.de:8021/0.2.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
# Allow only GET, HEAD
if ($request_method !~ ^(GET|HEAD)$ )
{
return 405;
}
# Allow only requests for published applications
if ($request_uri !~ ^/0.2.0/.*|^0.2.1/.*) {return 403;}
server_tokens off;
large_client_header_buffers 4 32k;
}
```
- Copy the application to /opt/bigdata/ and set permissions
```
chown -R bigdata.bigdata /opt/bigdata/*
touch /var/log/bigdata.log
chown bigdata.bigdata /var/log/bigdata.log
```
- Create Java application startup script (/opt/bigdata/bigdata.sh)
```
#!/bin/sh
# Check that the parameter is given for the version
if [ -z "$1" ]
then
echo "No instance version supplied"
exit 1
fi
# Create the listening port from the version
port=$(echo "8" $1 |sed 's/[^0-9]//g')
# Mount the network drive if not mounted
if [ ! -f /data/s3 ]; then echo "S3 not mounted, mounting";
goofys --endpoint https://s3.embl.de --uid=1000 --gid=1000 --dir-mode=0777 --file-mode=0666 --profile embl cbb-bigdata /data;
fi
echo "Starting the server"
cd /data/platy-browser-data/data/$1/misc/
java -Xmx4G -jar /opt/bigdata/bigdataserver.jar -d /data/platy-browser-data/data/$1/misc/bdv_server.txt -s cbb-bigdata01.embl.de -p 80 -b $port -P /0.2.1 -t /var/thumb &>/var/log/bigdata.log &
```
- Create Systemd for Java application (/etc/systemd/system/bigdata-0.2.0.service)
```
[Unit]
Description=Bigdata Platy image server 0.2.0
After=network.target
[Service]
User=bigdata
Group=bigdata
Type=forking
ExecStart=/opt/bigdata/bigdata.sh 0.2.0
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.targe
```
- Enable and start the services
```
systemctl daemon-reload
systemctl enable bigdata-0.2.0
systemctl restart bigdata-0.2.0
systemctl restart nginx
```
## Data generation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment