OpenShift notes
THIS IS FOR ARCHIVAL PURPOSES. THIS IS OUT-OF-DATE
backup OpenShift
openshift getenv(USER) from OpenShift php
ssh to {user}@{app-domain} gear snapshot > file
Run gear app
OpenShift migration further notes
Encrypt a file using a supplied password :
$ openssl enc -aes-256-cbc -salt -in file.txt -out file.txt.enc -k PASS
Decrypt a file using a supplied password :
$ openssl enc -aes-256-cbc -d -in file.txt.enc -out file.txt -k PASS
Add script to tar plugin, then rhc a SSH key into account, ssh to account and tar x data...
- get target directory
- clean-up target directory
- extract new contents
Probably can use deploy as an example...
- need to list images that have been uploaded to S3.
- need to convert imgsrc references...
? wordpress filters vs hooks ?
Sample stuff:
Skeleton
post types ... perhaps we add an S3 flag to the post type: Attachment
WordPress
Standard Customizations:
- Appearance
- Set theme
- Site Identity
- Header & Background iamge
- Menus: Set-up top bar?
- Settings
- General Settings
- Membership: Not anyone can register
- Timezone UTC
- Date/Time Format
- Reading
- For each article in the feed: Show full text
- Discussion
- Users must be registered to comment. Not fill out name+email
- Comments author must have previously approved comment
- Permalinks
- Month and name
- General Settings
Plugins
- Front Page Category
- Customizer, Front Page Categories, select what to show
- Collapsing category list
- Customizer, Widgets, Categories, customize...
- bbPress
- NO anonymous posting
- WP Social Login
- Bouncer
- Allow Username change
- Rich Revies
- Integrate user accounts
OpenShift Recipe
The official deploy tool dpl does not seem to work with secondary branches.
Pre-requisistes
- Install git
- Install RHC command line
- yum install epel-release
- yum install rubygem-rhc
- Install Travis command line
- yum install epel-release
- yum install ruby-devel rubygem-ffi (maybe others)
- gem install travis -v 1.8.2 --no-rdoc --no-ri
- A github, travis-ci and opens
Preparing Repo
This section can be skipped if we already have a github repo.
- Fork wordpress-example
- Create any additional branches as needed.
- Configure travis-ci by creating a basic
.travis.yml
- language: php
- php:
-
- '5.4'
- script: true
- Since
travis setup openshift
doesn't work, we need to use the DIY deploy script. So make a copy of it. And configure:- env:
- _ global:
- __ OPENSHIFT_USER=$username
- __ OPENSHIFT_SECRET=$secret
- Obviously the secret should be encrypted using:
- travis encrypt OPENSHIFT_SECRET=$secret [--add env.global]
- Obviously the secret should be encrypted using:
- script:
-
- sh deploy.sh
- diydeploy:
-
- deploy $branch:$openshift_app ... initially empty...
Deploying Repo to OpenShift App
- Create a new Application from the Openshift
console.
- Use (WordPress 4)
- Just leave initial repo to the default
- Decide on scaling options.
- DO NOT GO THROUGH SITE INSTALL YET!
- Add the $branch:$openshift_app to the
.travis.yml
, and push so travis-ci will deploy. - Tweak configuration:
- force https through .htaccess.
- Enable MULTISITE (if needed)
- Enable custom domain
- Create Domain Name (on DNS) and add custom domain in OpenShift
- Add Certificate to OpenShift (self-signed or maybe CloudFlare)
- openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes
- Wait for DNS to propagate
- Log-on to the site and go through installation.
- Verify that URLs use https:
- Dashboard -> Settings -> General
- Verify in Permalinks that https is used.
Fork syncing
- Clone repo
- Configure a remote fork
1. git remote -v
2. git remote add upstream https://github.com/openshift/wordpress-example.git
- Syncing a fork
1. git fetch upstream
2. git checkout master
3. git merge upstream/master
//define('DOMAIN_CURRENT_SITE', 'dev.iliu.net');
if ($_SERVER['SERVER_NAME'] != 'dev.iliu.net') {
define('DOMAIN_CURRENT_SITE', 'iliu.net');
} else {
define('DOMAIN_CURRENT_SITE', 'dev.iliu.net');
}
openshift mailgun
Success! You're signed up and we just created your sandbox server sandboxf9dbaaa2f22a49a693955138381837e7.mailgun.org
Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
use Mailgun\Mailgun;
# Instantiate the client.
$mgClient = new Mailgun('key-xxxxxxxxxxxxxxxxxxxxxxxxx');
$domain = "sandboxf9dbaaa2f22a49a693955138381837e7.mailgun.org";
# Make the call to the client.
$result = $mgClient->sendMessage("$domain",
array('from' => 'Mailgun Sandbox <[email protected]>',
'to' => 'Alejandro Liu <[email protected]>',
'subject' => 'Hello Alejandro Liu',
'text' => 'Congratulations Alejandro Liu, you just sent an email with Mailgun! You are truly awesome! You can see a record of this email in your logs: https://mailgun.com/cp/log . You can send up to 300 emails/day from this sandbox server. Next, you should add your own domain so you can send 10,000 emails/month for free.'));