Brought to you by the good folks at
An engineer's practical guide to the XN Framework.
On the host machine, use to generate
xnlogic applicationOn the VM, which you can access using .
xnlogic ssh~$ gem install xnlogic~$ xnlogic application my_app --key my_xn_user:passwordCreate a new application
~/my_app$ xnlogic upStart the VM, for an existing application.
~/my_app$ xnlogic sshLog into the VM.
~/my_app$ xnlogic haltStop the VM (can be restarted later, using xnlogic up)
~/my_app$ xnlogic destroyDestroy the VM (i.e. Stop it and delete all files).
* On slower computers, can be used to free resources when not using the VM.
* Free hard-drive space, taken by the VM image.
* In dev environment, the database will be deleted, as it is stored on the VM.
~$ xnlogic helpMore info
* The mounted directory (which lives on the host machine) is not deleted.
~/my_app$ ls
config Gemfile lib Readme.md torquebox_init.rb
config.ru Gemfile.lock my_app.gemspec spec torquebox.yml
dev Jarfile.lock Rakefile tasks Vagrantfile~/my_app$ ls lib/my_app
fixtures.rb models.rb permissions.rb type.rb
initializers parts type version.rbYour application code:
The full stack:
➜ ~ ls
bin my_app tmp xn.dev~/my_app is mounted from the host machine:
➜ ~ xn-consoleTest your code interactively
➜ ~ xn-serverOr run it in a server.
The xn-console loads the full stack and allows you to:
> PM.create_client('my_app', 'db01')Create a database.
> app = PM['db01']Get the application (given an existing database name).
> g = app.graphGet the underlying graph object.
> g.v.out_e.in_vRun queries on the graph.
> g.v(MyApp::M::User, {username: 'lenora'}).follows.tweets.count > MyApp.reload!Reload code changes.
> include app.consoleEnable simulating API calls from the console.
> xget '/model'Simulate API calls.
> xpost '/model/user/id/73/action/follow', {user_id: 79} > xdelete '/model/user/id/143' > hg = app.history_graphGet a reference to the history graph.
Run queries on the history graph.
> u = hg.v(MyApp::M::User, Pacer::Temporal).first
> u.tweets.count
=> 5
> u.at_time(u.first_transaction.time).tweets.count
=> 0➜ ~ sudo service datomic statusManage the Datomic service (used for the History Graph)
➜ ~ ls xn.dev/tmp/server.logServer log.
➜ ~ ls /opt/xn_apps
admin_token datomic.data datomic.pid
authenticator_token datomic.log my_appXN Data folder.
Kill hanging programs (e.g. after unexpected shutdown).
➜ ~ xn.dev/script/killerDatabase data files (all databases of the my_app application).
➜ ~ ls /opt/xn_apps/my_app