Jump to content

Installing ProcessWire on OpenShift


Dups Rin
 Share

Recommended Posts

Guide to installing ProcessWire on the OpenShift PaaS.

Create an account at http://www.openshift.com.'>http://www.openshift.com. Next, select Create Application at the top of the screen and PHP 5.3. Once that is done, add a MySQL 5.1 cartridge to the PHP application.

You'll get the following info from creating the PHP app and MySQL cartridge.
 

Git Repository
ssh://51d12b59500446e0df000118@processwire-example.rhcloud.com/~/git/processwire.git/

MySQL 5.1 database added. Please make note of these credentials:Root User: <removed by Pete> Password: <removed by Pete>Database Name: processwire

Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/


Setup the OpenShift RHC client tool, Git and Ssh.

link with more info, https://www.openshift.com/developers/rhc-client-tools-install'>https://www.openshift.com/developers/rhc-client-tools-install



Get the database hostname

Ssh to the server and run the following command to get the database info. You will need this info at the ProcessWire setup screen.

ssh 51d12b59500446e0df000118@processwire-example.rhcloud.com
env | grep OPENSHIFT_MYSQL





OPENSHIFT_MYSQL_DIR=/var/lib/openshift/51d12b59500446e0df000118/mysql/
OPENSHIFT_MYSQL_DB_PORT=3306
OPENSHIFT_MYSQL_DB_HOST=127.7.170.2
OPENSHIFT_MYSQL_DB_PASSWORD=<removed by Pete>
OPENSHIFT_MYSQL_IDENT=redhat:mysql:5.1:0.2.0
OPENSHIFT_MYSQL_DB_USERNAME=<removed by Pete>
OPENSHIFT_MYSQL_DB_SOCKET=/var/lib/openshift/51d12b59500446e0df000118/mysql//socket/mysql.sock
OPENSHIFT_MYSQL_DB_URL=mysql://<removed by Pete>@127.7.170.2:3306/
OPENSHIFT_MYSQL_DB_LOG_DIR=/var/lib/openshift/51d12b59500446e0df000118/mysql//log/





Setup local Git repository

Clone the application's Git repository to your local machine with following command.

git clone ssh://51d12b59500446e0df000118@processwire-example.rhcloud.com/~/git/processwire.git/

Fetch the ProcessWire source and code and add them to the php on the local repository with these commands

cd processwire
git clone https://github.com/ryancramerdesign/ProcessWire'>https://github.com/ryancramerdesign/ProcessWire
mv ProcessWire/* php/
mv php/htaccess.txt php/.htaccess
rm -rf ProcessWire



Push to the Openshift server
Commit and push to the Openshift server with following commands:

git add .
git commit -m 'Setup ProcessWire'
git push



Complete the ProcessWire setup
Acesss and complete the ProcessWire setup at your application's URL: http://processwire-example.rhcloud.com

Use the IP address for the MySQL DB, in this case, 127.7.170.2 instead of the environment variable, $OPENSHIFT_MYSQL_DB_HOST

Edited by Pete
Sensitive usernames and passwords removed from post
  • Like 9
Link to comment
Share on other sites

Hi Dups,

Thanks for detailed tutorial.

Could you also show how to delete initial ProcessWire install files/folder? Also, please show a sample push request.

Here are some excellent GIT tutorials:

GIT:

01. 

02. http://git-scm.com/book

03. http://try.github.com/

04. http://sixrevisions.com/resources/git-tutorials-beginners/

05. http://overapi.com/git/

  • Like 1
Link to comment
Share on other sites

thanks :)

@fatih

its not really necessary to delete the initial ProcessWire folder as long as the files are copied to the php/ directory in your local repository before the push.

A successful push request will look like this:

$ git push
Counting objects: 1156, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1108/1108), done.
Writing objects: 100% (1153/1153), 5.36 MiB | 129 KiB/s, done.
Total 1153 (delta 68), reused 0 (delta 0)
remote: CLIENT_MESSAGE: Stopping Apache+mod_php HTTPD server
remote: Waiting for stop to finish
remote: CLIENT_MESSAGE: Starting Apache+mod_php HTTPD server
To ssh://51d3c88050044613d3000048@pw1-example.rhcloud.com/~/git/pw1.git/
   a81af67..8de99c7  master -> master
 
You might need to set your sessionFingerprint to false too if ProcessWire keeps logging you out of the system. More info here: 
 
 
Link to comment
Share on other sites

Thank you for your replies, I learned many things from these tutorials. I received this error after PW installation.

Error: Exception: DB connect error 2005 - Unknown MySQL server host 'Config' (1) (in /var/lib/openshift/51d44a53e0b8cd3e1d0000d3/app-root/runtime/repo/php/wire/core/ProcessWire.php line 96)

This error message was shown because /install.php still exists. Error has been logged.

Remote config file remained unchanged during installation! To solve this error, I followed steps below after installation:

- deleted local install.php file and site-default/install folder

- updated local config file with new mysql connection & userAuthSalt parameters

- git add .

- git commit -a -m 'Delete Setup Files & Update Config File'

- git push

- checked remote config file. it has correct db parameters.

However, I still get DB connect error 2005 - Unknown MySQL server host 'Config' error. Do you have any idea? Did you get any missing db config error after your installations?

Link to comment
Share on other sites

@fatih

I'm not sure you should delete the install.php and site-default folder.

Can you show the settings from your site/config.php file?

$config->dbHost = '';

$config->dbName = '';

$config->dbUser = '';

$config->dbPass = '';

$config->dbPort = '';

Nope, I did not get a DB connect error after installing..

Link to comment
Share on other sites

@fatih

I'm not sure you should delete the install.php and site-default folder.

Can you show the settings from your site/config.php file?

$config->dbHost = '';

$config->dbName = '';

$config->dbUser = '';

$config->dbPass = '';

$config->dbPort = '';

Nope, I did not get a DB connect error after installing..

Hi Dups,

This my config file db settings: 

<Removed by Pete>

 
Also, these are my all setting parameters. Since this installation is tentative, you can connect and edit the files.
 

<Removed by Pete>

Edited by Pete
User had posted sensitive usernames and passwords leaving their hosting vulnerable.
Link to comment
Share on other sites

@fatih

I think you're using a scaleable PHP gear because the OPENSHIFT_MYSQL_DB_HOST is a hostname rather than an IP address. I tried setting up a scaleable PHP gear following the same instructions as above: Its running here http://pw1-pwtest.rhcloud.com

Applications that store files on the filesystem aren't scaleable on OpenShift because there isn't a shared filesystem for all instances. I think you'll face problems if you upload files to site/templates for example.

Have not seen the error msg you posted, 

Error: Exception: DB connect error 2005 - Unknown MySQL server host 'Config' (1) (in /var/lib/openshift/51d44a53e0b8cd3e1d0000d3/app-root/runtime/repo/php/wire/core/ProcessWire.php line 96)
 
This error message was shown because /install.php still exists. Error has been logged.

but have seen a different error msg when installing with the OpenShift environment variable, OPENSHIFT_MYSQL_DB_HOST rather than an IP address or hostname..

Link to comment
Share on other sites

@fatih - I would suggest that you change all of the passwords you linked to in your last post, as anyone reading it can now mess up your hosting. Also, Google indexes these forums extremely quickly so it is likely that anyone can now access your hosting.

Never post real usernames/passwords in forums - if you need to pass on such details, use the personal message feature here or encrypted email.

@dups - you seem to have done the same in your first post too!

  • Like 1
Link to comment
Share on other sites

@Dups,

I solved the problem. I should have changed "site-default" folder name as "site". In fact, PW is programmed to change "site-default" folder name, update config file and create new folders under site/assets during installation. However, Openshift does not give read&write permissions by default. They need to be defined via scripts in .openshift/action_hooks/ .

for example, this line should be added to .openshift/action_hooks/build : chmod -R 0777 ${OPENSHIFT_REPO_DIR}php/  (777 at least during installation)

However, I couldn't succeed after many trials. Do you have any experience about these scripts?

ps: Although PW seems to be installed and functioning perfectly at first, I start to get errors after starting to install new modules.

Link to comment
Share on other sites

@fatih

Nope, I did not have to modify action_hooks or rename site-default.

I think it will not work properly if you add modules to site/modules/ on a scaleable PHP gear. Use the non scaleable PHP gear instead.

Link to comment
Share on other sites

  • 2 weeks later...

Hi everyone,

I solved my problem. In fact, I discovered that there was no installation problem as Dups said. ProcessWire is being installed perfectly with correct file&folder permissions. However, I realized that I was pushing new changes without a clean after-installation pull :( This was ruining everything.

Now I have another problem. I cannot pull the remote after-installation PW files to local. I tried 'git clone ssh://....@....git/' or ''git pull ssh://....@....git/' but no success. However, I can see remote file changes via sftp. Do you have any idea?

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 months later...

Hi everyone,

I solved my problem. In fact, I discovered that there was no installation problem as Dups said. ProcessWire is being installed perfectly with correct file&folder permissions. However, I realized that I was pushing new changes without a clean after-installation pull :( This was ruining everything.

Now I have another problem. I cannot pull the remote after-installation PW files to local. I tried 'git clone ssh://....@....git/' or ''git pull ssh://....@....git/' but no success. However, I can see remote file changes via sftp. Do you have any idea?

Thanks.

I solved that problem by ssh into the server

ssh <user>@<domain>.rhcloud.com 

and tar all files

within 

app-root/repo/php

tar all files from processwire after installation

tar -zvcf pw.tar.gz .

logout from ssh and cd into the local php directory and delete all files

rm -rf .

for x in `git status | grep deleted | awk '{print $3}'`; do git rm $x; done
 
 

then download that tar inside the php directory

wget http://<myapp>.rhcloud.com/pw.tar.gz

and untar it

tar -xvf pw.tar.gz 

finally commit changes

git add .
git commit -m "Processwire Setup"
git push

now you can develop :P

Link to comment
Share on other sites

  • 3 weeks later...

Hey again,

I found OpenShift quite nice and I am liking it a lot. There was one problem with custom domains, however: I could not make it work with my second-level domain (I will use example.org as, well, an example). So people could see my website just fine at www.example.org but could not reach it at example.org. Bummer!

Technically speaking, there's no way you can have your "root" domain name as a CNAME for another one.

Despair not, there is a way to make it work both ways. Here's how:

1. Add an alias to your OpenShift gear, the alias should be a domain name you pwn (I will continue to use example.org for this example)

2. Register for free with cloudns.net and create a DNS zone for your domain there (create NS records at least).

3. Update name servers for your domain (ns1.cloudns.net up to ns4.cloudns.net).

4. At Cloudns, create a Web Redirect (WR) record so that example.org would point to http://www.example.org

5. Finally, Add a CNAME record www.example.org pointing at <gear>.rhcloud.com

Now you are good to go. Each time you go example.org you will be redirected to www.example.org -- and to your OpenShift application!

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...