bioentity / Bioentity.link

Other
0 stars 0 forks source link

Update instructions

Production branch is production, and should not be pushed as it contains the password.

Git changes from master via git pull origin master.

Update in order:

BioEntity.Link Production update

Production Trouble-shooting / info

The following ports should be open:

  netstat -tan | grep LISTEN
  tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
  tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN     
  tcp6       0      0 :::8080                 :::*                    LISTEN     
  tcp6       0      0 :::80                   :::*                    LISTEN     
  tcp6       0      0 :::7473                 :::*                    LISTEN     
  tcp6       0      0 :::7474                 :::*                    LISTEN     
  tcp6       0      0 :::21                   :::*                    LISTEN     
  tcp6       0      0 :::22                   :::*                    LISTEN     
  tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN     
  tcp6       0      0 :::7687                 :::*                    LISTEN 

or maybe

  neo4j start 

To login to the neo4j server:

  cypher-shell

and then: neo4j/LAT8gjThKJ26TR

Use neo4j-admin dump and neo4j-admin load to dump and load.

To restart both the tomcat and neo4j server:

  sudo service tomcat8 stop 
  sudo service neo4j stop 

Confirm that the servers are both down as above or use ps -ef | grep neo4j and ps -ef | grep catalina.

Then restart in this order:

  sudo service neo4j start
  sudo service tomcat8 start

If all else fails you may need to reboot the whole thing (which will be unusual):

  sudo init 6

When things come back up, make sure all of the services have started as above. If not, follow the instructions on how to restart them.

Unbuntu 16 production deployment

Install:

To run neo4j in docker:

docker run \                  
    --publish=7474:7474 --publish=7687:7687 \
    --volume=$HOME/neo4j/data:/data \
    --volume=$HOME/neo4j/logs:/logs \
    neo4j:3.1

GIT CLONE:

NEO4J INSTALLATION:

BUILD FOR TOMCAT

Getting started (Dev Environment)

Reference Documentation

Matching docs

From https://github.com/InSilicoLabs/dmc-grails/issues/157

Has a DOI ending in 200592:

TODO (move to GH / Asana later)

Angular2 with Grails profiles and Texture

Angular2

Use this doc to get the build going:

Install most recent stable node and npm and angular-cli.

npm install -g angular-cli 

Texture

Texture is forked here: https://github.com/InSilicoLabs/texture

Putting it all together

Run them separately for best results:

# terminal 1, server port 8080
cd server 
./grailsw run-app

# terminal 2, ng port 4200
cd client 
ng serve

# terminal 3, ng port 5555
cd texture 
npm run start 

All can be accessed at http://localhost:port/

Deploy production

Server

cd server 
./grailsw war
sudo systemctl stop tomcat8
sudo rm -rf /var/lib/tomcat8/webapps/dmc
sudo cp build/libs/dmc-0.1.war /var/lib/www/dmc.war
sudo systemctl start tomcat8

Note: I'm currently using run-app with screen instead of the proper war file.

NG2 Client

cd client 
ng build --prod 
sudo rm -rf /var/www/html/*
sudo cp -r dist/* /var/www/html/

Texture Client

If not available when you clone (would have to clone recursive) do:

git submodule update --recursive --remote
git pull --recurse-submodules

The build as normal:

cd texture
rm -rf dist
npm install 
node make 
# ctrl-c (will have built it)
sudo rm -rf /var/www/html/texture/
sudo cp -r dist /var/www/html/texture

Neo4j Production Notes

In neo4j.conf you have to set the address as follows:

dbms.connectors.default_advertised_address=dev.insilicodesigns.com

dbms.connectors.default_advertised_address=dev.insilico.link
dbms.memory.heap.max_size=8g

and I think these as well:

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
dbms.connectors.default_listen_address=0.0.0.0 

These might already be set by default, but if not, they need to be exposed:

# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=OPTIONAL
dbms.connector.bolt.listen_address=:7687

# HTTP Connector. There must be exactly one HTTP connector.
dbms.connector.http.enabled=true
dbms.connector.http.listen_address=:7474

Set the ulimit on some instances in the startup neo4j script:

ulimit -n 100000 # default is 1024

Clean out database

MATCH (n:Lexicon)-[s:LEXICONSOURCE]-(p:LexiconSource) return n limit 25 ;
MATCH (n:Lexicon)-[s:LEXICONSOURCE]-(p:LexiconSource) delete s  ;

MATCH (c:LexicaCapture)-[r:LEXICA]-(n:Lexicon) return c limit 5 ;
MATCH (n:LexicaCapture)-[r:SOURCE]-(q:LexiconSource) delete r,n;
match (s:Lexicon)-[r:LEXICA]-(c:LexicaCapture) delete s,r,c;

MATCH (n:Lexicon)-[r:LEXICA]-(k:KeyWord) return n limit 5 ;
MATCH (n:Lexicon)-[r:LEXICA]-(k:KeyWord)  delete r ;

MATCH (n:Lexicon) delete n ;

MATCH (n:KeyWord)-[r:KEYWORDSET]-(q:KeyWordSet) return n limit 25 ;
MATCH (n:KeyWord)-[r:KEYWORDSET]-(q:KeyWordSet) delete r;
MATCH (n:KeyWord) delete n ;
MATCH (n:KeyWordSet)-[r:SOURCES]-(s:LexiconSource) return n ;
MATCH (n:KeyWordSet)-[r:SOURCES]-(s:LexiconSource) delete n,r ;

MATCH (n:KeyWord) delete n ;

// delete markups
MATCH (n:Markup)-[r:PUBLICATION]-(p:Publication) delete r ;
MATCH (n:Markup)-[f:FINALLEXICON]-(l:Lexicon) delete n,f  

Other Notes

Example configuration for Grails / Neo4j tests: https://github.com/grails/gorm-neo4j/tree/master/examples

Other Important Set

MATCH (kws:KeyWordSet)--(k:KeyWord)--(l:Lexicon)--(s:LexiconSource) where s.source='Source 3'  RETURN kws,k,l,s limit 25

License

CC BY-NC 4.0