Deploying blog on OpenShift
- Create Python2.7 application on openshift.
- Add MySQL5.5 cartridge. Write down the db name.
- Create ssh key on your local machine and add public key to your openshift app.
- Fork this repo and clone to your local machine.
- Add openshift as second remote repo:
git remote add openshift ssh://ydfg8sdf6g8o7sbrtsogpdfgs@<my_app>.rhcloud.com/~/git/blog.git/
- Open file
itblog/itblog/settings.py
and change db name on yours (from #2). - Open file
itblog/credentials.py
and past there your mail settings (I can't still add env vars on openshift - TODO). - 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.
- Push your code to openshift:
git push openshift master --force
-
Add the following environment variables to ~/.profile:
export ADMIN_MAIL='[email protected]' # 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
-
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
.