Configuring Neo4j on Rails to Deploy with Warbler - ruby-on-rails

How do you configure a Neo4j on Rails app to deploy with Warbler? As it stands, every time I deploy my app, the previous production instance of neo4j gets destroyed, because neo4j is embedded. I was hoping that there would be some kind of configuration for production, either through Warbler or through neo4j, so that once a neo4j instance is created on the server it is not replaced with the next deployment.

I guess you could place the neo4j database somewhere persistent outside your volatile codebase and then open Neo4j against e.g. /var/database ? In case there are existing files, Neo4j will not replace them.

Related

Neo4j Dump and Restore

Ubuntu 20.04 running multiple databases running with different version numbers in a project in Neo4j Desktop 1.2.7 and need to move them over to a newly installed machine with the latest version of Neo4j Desktop (not sure which version that is because on the SSD that's unplugged right now!).
Tried:
bin/neo4j-admin dump --database="MYDATABASENAME" --to=/dumps/MYDATABASENAME-.dump"
Which gives error "Database does not exist" error as I understand the default database is "neo4j" and that this somehow contains the other databases? Makes no sense to me.
Tried:
bin/neo4j-admin dump --database=neo4j --to=/dumps/DougiDatabases.dump"
...Thinking that the neo4j database may contain all the other databases and that did dump. but the file was only 5Mb or so, where my databases are a number of Gb, so clearly not correct.
In system database I do SHOW DATABASES and it shows me the neo4j and system databases, but nothing else.
I've seen some mention of a dump button in the three dots by a database in Neo4j Desktop, but I don't have that (regardless of DB running or not). I only have a clone option.
Previously I have copied the database files from the /home/MYNAME/.config/Neo4j Desktop/Application/neo4jDatabases folder and then updated the databases listed in the /home/MYNAME/.config/Neo4j Desktop/Application/persist/databases.json, but it seems that the folder structure in the latest version of Neo4j Desktop has a different structure, so I wasn't sure if I could still do this. Not tried.
Driving me mad. This should be so easy.
What do I do please?
I worked it out. For databases 3.x you need to use "graph.db" as the database name. For databases 4.x you always use "neo4j" as the database name.
e.g.
bin/neo4j-admin dump --database="graph.db" --to="/dumpsFolder/myDatabase.dump"
bin/neo4j-admin dump --database="neo4j" --to="/dumpsFolder/myDatabase.dump"
You need to to into the admin area for each database, launch the terminal and execute these commands. In the latest version of Neo4j Desktop you can then copy the dump files into the root of the project. e.g.
/home/USERNAME/.config/Neo4j Desktop/Application/projects/project-XXX
Then click the ... next to the dump name in Neo4j Desktop and "create from dump file" or similar. You select the database version, name it, set a password and continue. The database will restore.

Non_exist relationships displayed in LInux Neo4j (version3.5)

HI i am using a aws ec2 to run a neo4j server. Before that I test in my local machine (Mac OS). everything works fine. But when I uploaded the same graph.db to ec2 and call db.schema(), there are some non-exists relationships. I acknowledge these relationships exist in my old graph.db. but I already deleted the whole graph.db file before load again. So I am wondering there are may be cached by neo4j? I run some queries for the relationships, there are do have some nodes show up. How can I fix this?
This is a long-standing issue that has was reported in version 3.2.2 and still apparently exists in 4.0.0.

Accessing the solr folder folder from multiple server instances

AWS has just announced general availability of its EFS (Elastic File System). It allows you to create a network drive that can be shared by multiple AWS instances.
I have a Rails application, using sunspot-solr gem. A solr folder is created to store the solr index file and other related data.
The MySQL data is on its own RDS instance. I want to deploy two servers, both running the same Rails application, but have them both point to the same solr folder on the shared EFS share.
Assuming that both servers running the Rails app, are using the same solr gem version, will my scenario work, or will each server need its own solr folder?
I'm pretty sure the version of Solr packed with the development version of Sunspot is a separate Solr server that Rails communicates with. So in production, you are responsible for providing a Solr server for these purposes, be it on one of your EC2 instances or on its own separate EC2 instance.
A little more info... Rails posts data for Solr to consume via Sunspot, but the Solr server handles those details, not your Ruby app. Therefore, sharing the Solr data files with Rails won't provide you with any advantage.
When I was getting started, I hooked my Heroku-hosted Rails app up to Websolr if you think that $20+ per month would be worth it. Otherwise, look up tips for installing Solr on EC2.

Its lock file has been locked by another process - Neo4j Embedded

I am developing a embedded application of the Neo4j and I try run this but I get this error:
Store and its lock file has been locked by another process:
/home/dev/neo4j-community-2.3.2/data/graph.db/store_lock. Please
ensure no other process is using this database, and that the directory
is writable (required even for read-only access)
I know that is because the neo4j server application is running and it lock the directory to writable for another application.
But I want run both, the neo4j server with browser studio and my embedded application.
I am use the community edition 2.3.2 in Linux.
How can I do it?
It is possible in enterprise version?
Thanks
On the very same directory you can only run at most one instance at a given time.
Enterprise edition enables master-slave replication, so the graph.db is folder is propagated from master to slave instance. This would be an option for you.
I assume you want to access you embedded instance via the browser. See this blog post http://graphaware.com/neo4j/2014/11/21/neo4j-browser-with-embedded.html - be aware this one is based on 2.1 - as far as I remember in 2.3 some things have changed since then.

Do I need to install Tomcat and MySQL on the Linux server to deploy Grails app?

My Grails app is based on
Gradle with Grails 2.4.4,
Tomcat plugin 7.0.55,
and MySQL plugin(mysql:mysql-connector-java:5.1.29).
Do I need to install Tomcat on the server?
Do I need to install MySQL on the server?
Both Tomcat and MySQL are not installed on dev environment(on my PC), but it seems working.
Container
While all the other answers pointed out, that you need already a container (which of course is true) there is also the option to use one of the "standalone" plugins (like e.g. https://grails.org/plugin/standalone). This will package your app as a fat jar, where the container and your app are part of a jar, that you simply run by java -jar myapp.jar (of course your would integrate that into your regular startup scripts on the server).
This is in general no bad option, since many WAR-deployed apps don't need any of the full blown container features anyway and you would be able to configure everything in place for your workload and don't have to compromise for all running wars (or your ops team). On the downside, if there is a security problem etc. with the container you would have to roll a new jar.
/With grails 3, which uses Spring Bootstrap, this even is a default option, since the preferred way of deploying. Spring Boot 1.2 supports Tomcat, Jetty, and Undertow by default./
Database
You can use a MySQL from "somewhere" else. But this is nitpicking, since you really need a MySQL somewhere (BTW: you really should start using MySQL also for your dev env, or you will be in for a few surprises once you put your stuff over to production).
Also be aware, that you can also keep using your H2 (see your datasource config) with files. This is an OK option (that saves you from installing a DB server) for small amounts of data you are storing and also there are other free database servers like PostgreSQL.
Obviously you have to install mysql and tomcat on the server.
During development you run grails from console, so you dont need tomcat as it will use embedded tomcat but still you need to have mysql installed, if you want to use mysql.
But on production, you create a war of your app using 'grails war command' and you deploy this war to a web container just like any other war, so you need tomcat and you will need mysql installed too.
In one word answer is 'Yes'.
Fact is when you are in development environment grails uses as an embedded tomcat server provided by the 'Apache Tomcat plugin' which version corresponds to grails version.
You've not installed mysql and you claimed 'it seems working'. That's funny! But it's not mysql who is working without being installed(!), rather it's also an integrated database provided by the 'H2 Database Plugin'.
So, when you'll deploy your grails app in Linux or another server certainly you need a tomcat server to handle user request to that app and a database where your data will be saved.

Resources