Setting up pyramid and mongodb on webfaction

From ITRS
Jump to: navigation, search

mongodb

  1. setup custom app (listen on port) named mongodb at webfaction pannel.
  2. download numactl. install it to local dir.
  3. download the 64-bit mongodb at http://www.mongodb.org/downloads, tar and move the conetent to the $HOME/mongodb/; cd $HOME/mongodb/
  4. $ mkdir data
  5. $ vi mongo.conf; set port allocated at the custom app. and dbpath to the data dir
  • vi bin/start
#!/bin/sh
PREFIX=$HOME/webapps/mongodb
export LD_LIBRARY_PATH=$HOME/lib64 && nohup numactl --interleave=all $PREFIX/bin/mongod \
--config=$PREFIX/mongo.conf 2>/dev/null 1>/dev/null &
  • vi bin/stop
#!/bin/sh
PREFIX=$HOME/webapps/mongodb
kill -2 `cat $PREFIX/data/mongod.lock`
  • vi bin/restart
#!/bin/bash
$HOME/webapps/mongodb/bin/stop
sleep 3
$HOME/webapps/mongodb/bin/start
  • $ crontab -e; add start to crontab

pyramid

  1. setup pyramid app at webfaction pannel. This will give you a virtualenv and internal port number. If you will change the default application, beaware to listen on the same port.
  2. create a git --bare repo at myapp
  • vi myapp/.git/hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=$HOME/webapps/pyramid_app/myapp git checkout -f
$HOME/webapps/pyramid_app/bin/restart
  1. Clone it back. Now if you push to the server, it will automatically load and restart the app

Comments

blog comments powered by Disqus