-
ruby stuff
$ sudo aptitude install ruby $ sudo aptitude install rubygems $ sudo gem install json_pure $ sudo gem install rake $ sudo gem install rhc -
fix the error file mime-types-1.18.gemspec then re-install all gems needed
#should be line 9, changed it to: s.date = %q{2012-03-21} $ sudo vim /var/lib/gems/1.8/specifications/mime-types-1.18.gemspec $ sudo gem install json_pure $ sudo gem install rake $ sudo gem install rhc
###now play with openshift
-
apply a account on https://openshift.redhat.com/, get your email,password
#create a domain(namespace) $ rhc domain create -n domain -l email #create a app $ rhc app create -a appname -t python-2.6 -l email #now you will get folder named `appname` -
if your app is new app created int step 1,skip this step
#create keys $ ssh-keygen -t rsa -f ~/.ssh/libra_id_rsa -C email #add public key $ rhc sshkey add -i public_key_name -k ~/.ssh/libra_id_rsa.pub -l email #edit your ssh config $ cat ~/.ssh/config Host *.rhcloud.com IdentityFile ~/.ssh/libra_id_rsa -
show git url
$ rhc domain status -l email$ rhc domain show -l email Git URL: ssh://[email protected]/~/git/api.git/ -
then you can ssh,make yourself at home
$ssh [email protected] -
git stuff
#clone your app by git url or it's alreay created by step 1 #modify setup.py $ cd appname #change install_requires=[''],use django,web.py,bottle or something $ vim setup.py $ cd wsgi #use django web.py wsgi #webpy example <https://github.com/ehazlett/openshift-webpy-example/blob/master/wsgi/application> $ vim application #add and commit $ git push -
python stuff,get your project home folder if want to use web framework's template
def get_home_dir(): try: dir1 = os.environ['OPENSHIFT_REPO_DIR'] if dir1.endswith('/') == False: dir1 += '/' dir1 += 'wsgi/' return dir1 except: return './'#shoud be /,not have permission -
show log
$rhc-tail-files -l email -a appname