Skip to content

anapana/it-recipes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploying blog on OpenShift

  1. Create Python2.7 application on openshift.
  2. Add MySQL5.5 cartridge. Write down the db name.
  3. Create ssh key on your local machine and add public key to your openshift app.
  4. Fork this repo and clone to your local machine.
  5. Add openshift as second remote repo:
    git remote add openshift ssh://ydfg8sdf6g8o7sbrtsogpdfgs@<my_app>.rhcloud.com/~/git/blog.git/
  6. Open file itblog/itblog/settings.py and change db name on yours (from #2).
  7. Open file itblog/credentials.py and past there your mail settings (I can't still add env vars on openshift - TODO).
  8. There are two action hooks:
  • .openshift/action_hooks/pre_start
  • .openshift/action_hooks/post_start_mysql-5.5
    The second one syncs db and creates superuser. Remember superuser credentials and remove this line after first launch. You'll need to change superuser credentials in blog's dashboard.
  1. Push your code to openshift: git push openshift master --force

For local development

  1. Add the following environment variables to ~/.profile:
    export ADMIN_MAIL='admin@gmail.com' # put your email address here
    export ADMIN_PASS='pass' # put your email pass here
    export SMTP_SERVER='smtp.gmail.com' # your smtp here
    export SMTP_PORT='2525' # your smtp port
    export ITBLOG_APP_HOST='127.0.0.1' # is using in itblog/runserver.sh
    export ITBLOG_APP_PORT='8080' # is using in itblog/runserver.sh
    And source it:
    source ~/.profile

  2. Create python virtual environment (http://docs.python-guide.org/en/latest/dev/virtualenvs) and install requirements:
    pip install -r requirements.txt
    or
    pip install -r requirements/local.txt

requirements.txt file is used in production. For your extra packages you can use requirements/local.txt.

Releases

No releases published

Packages

No packages published

Languages

  • HTML 48.1%
  • CSS 23.7%
  • Python 18.7%
  • JavaScript 9.0%
  • PHP 0.4%
  • Ruby 0.1%