Skip to content

Instantly share code, notes, and snippets.

@mattvonrocketstein
Last active August 21, 2019 16:21
Show Gist options
  • Save mattvonrocketstein/96670d2eb66a8ad9854b6f52a2b5339c to your computer and use it in GitHub Desktop.
Save mattvonrocketstein/96670d2eb66a8ad9854b6f52a2b5339c to your computer and use it in GitHub Desktop.
neo4j setup with vagrant/ansible

Clone this gist into the working directory

git clone git@github.com:96670d2eb66a8ad9854b6f52a2b5339c.git vagrant-ansible-neo
cd vagrant-ansible-neo

Install the neo4j role into the working directory

ansible-galaxy install julienroubieu.neo4j -p .

Bring up the vagrant box

vagrant up --no-provision

Provision neo4j and it's pre-reqs (java etc)

vagrant provision

Confirm that neo4j is listening on the guest. It shouldn't be necessary, but do it anyway. Sometimes vagrant doesn't seem to honor the 7474:7474 guest/host port-forwarding rule until after "vagrant ssh" has been invoked once.

vagrant ssh -c "curl localhost:7474"

Confirm the host can connect to the guest's neo server. If you still can't connect, wait a while or try issuing the "vagrant reload" command and try again

curl localhost:7474
# comments removed for brevity, but this is the default config except
# that webserver.address was changed from 127.0.0.1 to 0.0.0.0
org.neo4j.server.database.location=data/graph.db
org.neo4j.server.webserver.address=0.0.0.0
org.neo4j.server.webserver.port=7474
org.neo4j.server.webserver.https.enabled=True
org.neo4j.server.webserver.https.port=7473
org.neo4j.server.webserver.https.cert.location=conf/ssl/snakeoil.cert
org.neo4j.server.webserver.https.key.location=conf/ssl/snakeoil.key
org.neo4j.server.webserver.https.keystore.location=data/keystore
org.neo4j.server.webadmin.rrdb.location=data/rrd
org.neo4j.server.webadmin.data.uri=/db/data/
org.neo4j.server.webadmin.management.uri=/db/manage/
org.neo4j.server.db.tuning.properties=conf/neo4j.properties
org.neo4j.server.manage.console_engines=shell
org.neo4j.server.database.mode=SINGLE
org.neo4j.server.http.log.enabled=False
org.neo4j.server.http.log.config=conf/neo4j-http-logging.xml
# comments removed for brevity, but this is the default config except
# that allow_store_upgrade is set to true
keep_logical_logs=true
online_backup_enabled=true
online_backup_server=127.0.0.1:6362
ha.pull_interval=10
allow_store_upgrade=true
- hosts: all
become: yes
become_method: sudo
gather_facts: yes
roles:
- {role: julienroubieu.neo4j}
tasks:
- name: Let neo auto-update old data schemas to work with current server version
template: src=neo4j.properties dest=/etc/neo4j/neo4j.properties mode="u=rw,g=r,o=r"
notify:
- restart neo4j-service
- name: Let neo listen on 0.0.0.0 instead of 127.0.0.1
template: src=neo4j-server.properties dest=/etc/neo4j/neo4j-server.properties mode="u=rw,g=r,o=r"
notify:
- restart neo4j-service
# -*- mode: ruby -*-keep_logical_logs=true
Vagrant.require_version ">= 1.8.0"
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.insert_key = false
config.ssh.forward_x11 = true
config.vm.box = 'ubuntu/trusty32'
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 7474, host: 7474
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
end
config.vm.provision "ansible" do |ansible|
ansible.verbose = "v"
ansible.playbook = "playbook.yml"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment