Giter Club home page Giter Club logo

openshift-diy-nginx-php's Introduction

boekkooi/openshift-nginx-php

This is a sample repository to get nginx + php fpm running on openshift.

More information about openshift: https://openshift.redhat.com/

If you are using openshift online you may want to take a look at the special nginx and php catridge

What's inside

The .openshift/action_hooks scripts:

  • build:
    • Build the versions of nginx, php and nodejs that are needed
  • build_*
    • The functions used for checking the versions and installing
  • deploy
    • This will render copy the nginx and php conf files
    • Copy the .bash_profile if there is none
  • common
    • A common include script for the action hooks (just setting some path's)
  • start
    • Starts Nginx and php-fpm
  • stop
    • Stops Nginx and php-fpm

The .openshift/tmpl templates:

Here are the templates used by the build and deploy scripts. Just customize away.

The web/ nginx web folder:

The web folder currently used. You can change this in .openshift/tmpl/nginx.conf.tmpl.

Usage

To get PHP 5.6 working at OpenShift, you have to do the following:

  1. Create a new Openshift "Do-It-Yourself" application
  2. Clone this repository
  3. Add a new remote "openshift" (You can find the URL to your git repository on the Openshift application page)
  4. Run git push --force "openshift" master:master
  5. SSH into your gear
  6. Wait for build to finish (This may take at least an hour)
  7. Open http://appname-namespace.rhcloud.com/ to verify

Extra's

Nodejs

Support for NodeJS is availible! Just uncomment NODE_VERSION in .openshift/action_hooks/build and commit/push the file.

Phalcon Framework

Support for Phalcon is availible! Just uncomment PHALCON_VERSION in .openshift/action_hooks/build and commit/push the file.

Known issues

PHP 5.4 won't build

To get PHP 5.4 to build open .openshift/action_hooks/build_php and remove --enable-opcache(line: 68).

Only index.php works in root dir

Currently the .openshift/tmpl/nginx.conf.tmpl configuration template for nginx only redirects to the web/index.php file. You can change this by editing the template file. Also see http://wiki.nginx.org/Symfony for some extra information.

The hooks are not executing

This probably happens because they are not executable. Just do git update-index --chmod=+x -- $(git ls-files .openshift/action_hooks/*) in your project root and commit/push.

Openshift disconnects on build

This seems to be a problem within openshift (see https://www.openshift.com/forums/openshift/openshift-build-timeout).

To resume the build, first make an arbitrary change to your local repo (e.g. add some text to README.md), commit that change and then do another git push --force "openshift" master:master.

Other

Maybe have a look at stackoverflow and if you end up empty-handed just create a issue.

Thanks

Thanks to the following people:

Reading material

Some articles that mention how you can use this repo and other related articles:

If you wrote a article about openshit and nginx+php please let me know so I can add it to the list.

openshift-diy-nginx-php's People

Contributors

boekkooi avatar coolspring8 avatar giftymalik avatar orthographic-pedant avatar pitekantrop avatar unisys12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openshift-diy-nginx-php's Issues

build timeout

I'm getting a timeout on the build stage. I saw the comment in the READMEabout this. I'm wondering if a bug has been submitted to Redhat and if so, what the bug ID is? (I looked but couldn't see one)

Here is my output showing the timeout error:

remote: An error occurred executing 'gear postreceive' (exit code: -1)
remote: Error message: Shell command '/var/lib/openshift/xxxxxxxxxxxxx/app-root/runtime/repo/.openshift/action_hooks/build' exceeded timeout of 3598
remote:
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://[email protected]/~/git/phpnginx.git/
 + d438ece...c4b509a master -> master (forced update)

And when the second push is run:

[xxx@xxxx openshift-diy-nginx-php]$ git push --force "openshift" master:master
Everything up-to-date
[xxx@xxxx openshift-diy-nginx-php]$

Would this mean the build continues on in the background or has permanently failed?

NGINX Forward Proxy

hi there, why i got : send() failed (1: Operation not permitted) while resolving, resolver: 8.8.8.8:53

  server {
    listen <%= ENV['OPENSHIFT_NGINX_IP'] %>:<%= ENV['OPENSHIFT_NGINX_PORT'] %>;
    server_name gist.domain.com;
    access_log off;


    location / {
        resolver 8.8.8.8;
        proxy_pass https://gist.github.com$request_uri;

        proxy_connect_timeout 6s;
        proxy_set_header Accept-Encoding "";
        proxy_set_header User-Agent $http_user_agent;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

php installation fails

Installation doesn't finish as php didn't get installed. Invoking the build script again brings the same error as on first try.

bash-4.1$ ./build
nginx up to date, version: 1.7.10.
PHP not installed.
Libtool up to date, version: 2.4.6.
LibMCrypt up to date, version: 2.5.8.
ICU up to date, version: 54.1.
Bison up to date, version: 2.7.12.
Re2c up to date, version: 0.14.3.
/tmp/build /var/lib/openshift/56xxxxxxx0f2/app-root/runtime/repo/.openshift/action_hooks
Downloading php-5.6.6.tar.gz:

  • skipping file exists.
    Unpacking php-5.6.6.tar.gz:
  • skipping directory exists.
    /tmp/build/php-5.6.6 /tmp/build /var/lib/openshift/56xxxxxxx0f2/app-root/runtime/repo/.openshift/action_hooks
    Configuring PHP.
    /var/lib/openshift/56xxxxxxx0f2/app-root/runtime/repo//.openshift/action_hooks/build_php: line 22: ./configure: No such file or directory

OpenShift disconnecting on build causes incomplete extraction

Currently, when OpenShift disconnects on a build, it sometimes causes the extraction to be incomplete. The script (when executed the next time) sees that the folder is already extracted, and just uses that incomplete extraction.

The extracted folder needs to be deleted and re-extracted.

Not tested on other packages, but this is happening in php.

PHP tidy

Sorry for my question.

Try build php with --with-tidy
but get error ( missing libtidy )
I don't have some idea for this. Can you help me???

Thanks

NPM post-deploy install?

It would be useful to add a step (if node is included) to also process npm dependencies upon repo deploy.

Wordpress

I did manage to get nginx server on openshift with this excellent repo. Any idea how I can install Wordpress on it?

Mcrypt: no supported ciphers and modes

Thanks for this repository, it helped me setting up nginx and PHP5.5.8 in my Openshift gear. However, I have issues with mcrypt (Laravel needs it).

In the phpinfo I can see it is enabled, but "Supported ciphers", "Supported modes" are "none". Do you have any ideas?

(I used the fork by duythien)

13: Permission denied

Hi.
I am new and trying to upgrade my skills by learning about developing in Cloud. I am following the instructions given in the website http://www.sitepoint.com/nginx-php5-5-phalcon-openshift/ but am using your repo instead of duythien forked one.

after 2 timeouts, Finally, php and other tools were compiled and installed but then at the time of activating, I am getting a permission denied error. Below is the extract of the message I am getting on my terminal everytime i am pushing it.

Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 366 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Stopping DIY cartridge
remote: Stopping nginx.
remote: Stopping PHP-fpm.
remote: kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
remote: Building git ref 'master', commit 42e50c2
remote: nginx up to date, version: 1.5.12.
remote: Libtool up to date, version: 2.4.2.
remote: LibMCrypt up to date, version: 2.5.8.
remote: ICU up to date, version: 51.2.
remote: PHP up to date, version: 5.5.11.
remote: PHP pecl mongo up to date, version: 1.5.1.
remote: NodeJs local old, version: v0.6.20.
remote: NodeJs up to date, version: v0.10.26.
remote: Creating NPM proxy.
remote: Preparing build for deployment
remote: Deployment id is 6be11402
remote: Activating deployment
remote: Pre-processing nginx config.
remote: Pre-processing PHP-fpm config.
remote: Copy bash profile.
remote: Starting DIY cartridge
remote: Starting nginx.
remote: nginx: [emerg] open() "/error.log" failed (13: Permission denied)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 534d4cc8e0b8cd1d1200023e (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/534d4cc8e0b8cd1d1200023e/diy)
remote: Deployment completed with status: failure
remote: postreceive failed
To ssh://[email protected]/~/git/blog.git/
   bff3edb..42e50c2  master -> master

Any help regarding this.

PCRE version 8.33 not found

In the build file, I changed the PCRE_VERSION variable to 8.36 because 8.33 was no longer on the ftp server.

The remote end hung up unexpectedly

Hello i'm getting this error every-time I tries to install.

remote: checking for PQprotocolVersion in -lpq... Connection to test-name.rhcloud.com closed by remote
 host.
fatal: The remote end hung up unexpectedly
error: error in sideband demultiplexer
To ssh://[email protected]/~/git/test.git/
   75bb35b..752b613  master -> master
error: failed to push some refs to 'ssh://[email protected]/~/git/test.git/'

Mysql?

how to connect with mysql?

I try add MySQL 5.5 cartridge, enable mysql on php.ini but can't connect.

Can you help me?
Thanks

How to use Phalcon v2.0 ?

The latest version of Phalcon right now is 2.0, but this repository still using the old version (v1.34).

Getenv Openshift variables

I only referenced getupcloud's repo in issue #13 to help you understand what I'm trying to achieve. I built an app using your repo and I'm seeking help to know what code should I add in .openshift/tmpl/php-fpm.conf.tmpl. I'm not a developer like you but only an enthusiastic learner. I read a lot and try to find answers myself before asking. I searched on internet but did not find anything specific to this. I also tried to use this code ENV.each do |name, value| puts "env[#{name}] = #{value}" but that did not work. I found very good article https://www.openshift.com/blogs/taking-advantage-of-environment-variables-in-openshift-php-apps but don't know which code should I use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.