OpenShift QuickStart - Laravel 5.0 Framework

Related tags

Laravel laravel
Overview

Laravel 5.0 on OpenShift

Laravel is a free, open source PHP web application framework, designed for the development of model–view–controller (MVC) web applications.

This QuickStart was created to make it easy to get started with Laravel 5.0 on OpenShift.

Looking for Laravel 5.2? Check out my Laravel 5.2 QuickStart for OpenShift 3.

The simplest way to install this application is to use the OpenShift QuickStart. If you'd like to install it manually, follow these directions.

OpenShift Considerations

These are some special considerations you may need to keep in mind when running your application on OpenShift.

Local vs. Remote Development

This Laravel QuickStart provides separate .env configuration files for both local and remote development, found at .env and .openshift/.env respectively. When the local repo is pushed to OpenShift .env is overwritten with the .openshift/.env file.

Remote Development

Your application is configured to automatically use your OpenShift MySQL or PostgreSQL database in when deployed on OpenShift using OpenShift Environment Variables.

Additionally, your APP_ENV, APP_URL, and APP_KEY will be set automatically in production on OpenShift.

The Laravel CACHE_DRIVER is set to use APC opcode caching and the SESSION_DRIVER is set to use the local file system for storage. Feel free to update these settings in .openshift/.env.

Laravel Migrations

When the application is pushed to OpenShift, php artisan migrate --force is automatically executed.

Composer

When the application is pushed, composer install is automatically executed over the root directory. See PHP Markers for more details on the 'use_composer' marker.

'Development' Mode

When you develop your Laravel application in OpenShift, you can also enable the 'development' environment by setting the APPLICATION_ENV environment variable, using the rhc client, like:

$ rhc env set APPLICATION_ENV=development -a <app-name>

Then, restart your application:

$ rhc app restart -a <app-name>

If you do so, OpenShift will run your application under 'development' mode. In development mode, your application will:

  • Set Laravel's APP_ENV to 'development' and APP_DEBUG to 'true'
  • Ignore your composer.lock file
  • Show more detailed errors in browser
  • Display startup errors
  • Enable the Xdebug PECL extension
  • Enable APC stat check

Set the variable to 'production' and restart your app to deactivate error reporting and resume production PHP settings.

Using the development environment can help you debug problems in your application in the same way as you do when developing on your local machine. However, we strongly advise you not to run your application in this mode in production.

Log Files

Your application is configured to use the OpenShift log directory. You can use the rhc tail command to stream the latest log file entries:

rhc tail -a <APP_NAME>

To stop tailing the logs, press Ctrl + c.

Manual Installation

  1. Create an account at https://www.openshift.com/

  2. Create a Laravel application:

    rhc app create laravelapp php-5.4 mysql-5.5 --from-code=https://github.com/luciddreamz/laravel
    

    or

    rhc app create laravelapp php-5.4 postgresql-9.2 --from-code=https://github.com/luciddreamz/laravel
    

Additional Resources

Documentation for the Laravel framework can be found on the Laravel website. Check out OpenShift's Developer Portal for help running PHP on OpenShift.

Comments
  • Cannot use Elixir (or other npm tasks)

    Cannot use Elixir (or other npm tasks)

    First of all, nice work ! It was really easy to deploy my Laravel app on Openshift with your cartridge, so thanks for that :smile:

    In order to fully automatize the deployment process, it would be cool to add a rule to execute npm tasks such as gulp or bower.

    I added my npm tasks in the build hook, but I have the well knew rights error:

    npm ERR! Error: EACCES, mkdir '/var/lib/openshift/XXXXXXX/.npm'
    npm ERR!  { [Error: EACCES, mkdir '/var/lib/openshift/XXXXXXX/.npm']
    npm ERR!   errno: 3,
    npm ERR!   code: 'EACCES',
    npm ERR!   path: '/var/lib/openshift/XXXXXXX/.npm' }
    npm ERR! Please try running this command again as root/Administrator.
    

    I tried to figure out how I can enable npm on my gear, or change npm's default temp folders but I didn't succeed so far.

    There is a better and simpler way to do that directly in the Laravel Cartridge ?

    opened by benVigie 4
  • Laravel 5.1 requires php5.6

    Laravel 5.1 requires php5.6

    Hi,

    Thank you for contributing this.

    I was wondering if you have any plans to upgrade to Laravel 5.1? It would also a PHP5.6 upgrade in the cartridge as well I think.

    Thanks in advance.

    opened by impbob 4
  • Composer support

    Composer support

    I can't see 'composer update' command anywhere in the action_hooks directory. Is composer supported? I used laravel 4 with the following 'build' action hook.

    !/bin/bash

    export COMPOSER_HOME="$OPENSHIFT_DATA_DIR/.composer" if [ ! -f "$OPENSHIFT_DATA_DIR/composer.phar" ]; then curl -s https://getcomposer.org/installer | php -- --install-dir=$OPENSHIFT_DATA_DIR else php $OPENSHIFT_DATA_DIR/composer.phar self-update fi ( unset GIT_DIR ; cd $OPENSHIFT_REPO_DIR ; php $OPENSHIFT_DATA_DIR/composer.phar install )

    https://github.com/vignesh0025/openshift-laravel4-quickstart/blob/master/.openshift/action_hooks/build

    But i could'nt find a similar one here. So how does it support composer?

    And please explain the settings of .env file configuration. If i want to add my data to remote .env file, how should i do it. I could'nt understand its working here. Its in .openshift directory for remote server. But how laravel will use it to get the required data.

    opened by vignesh0025-zz 4
  • composer self-update, composer.phar not be written

    composer self-update, composer.phar not be written

    Today I try to use a "intervention/image": "^2.3.*", whe I use "composer update" I have this error ( Could not parse version constraint 4.x.x: Invalid version string "4.x.x"), I read about this and found it´s because the old composer version (1.0-dev 2015-03-09 23:06:06). The file composer.phar can be updated?

    opened by DiegoMPerez 3
  • Possible to turn off artisan serve?

    Possible to turn off artisan serve?

    Not using this command is commonly use on shared hosting application but is this also possible to off on the cartridge. I just need this to one of my application.

    opened by christianesperar 2
  • Openshift - New controller not found

    Openshift - New controller not found

    Hi,

    I am new to openshift and i have a problem in deployment. I've pushed the updates to openshift repo by simply pushing to the master branch. It seems that the updates wasn't deployed properly. How do i make sure that all the updates are part of the deployment? I already added "php artisan cache:clear" on deploy action hook didn't help at all.

    How do check the last commit in the server? Thanks in advance.

    opened by wreeecks 2
  • fix the issue with css path in app.blade.php

    fix the issue with css path in app.blade.php

    The path in app.blade.php for the css style sheet was changed, and it wouldn't work on local development, it wasn't able to fetch the css file.

    Reverting to laravel way for referencing assets in views

    opened by flakron 1
  • Unable to update composer.phar

    Unable to update composer.phar

    It's been a long time (1+year ago) since I updated my app. Now I'm trying to deploy my updates and I've encountered the error below. I suspect that this error was caused by the outdated composer, so tried updating it by adding a script in post_deploy and deploy action_hooks. Unfortunately, it didn't work. Can you please help me with this error? Thanks in advance!

    Composer update script

    export MY_PHPCOMPOSER=$OPENSHIFT_DATA_DIR/composer.phar
    
    # if composer not exists, download
    if [ ! -f $MY_PHPCOMPOSER ]; then
        cd $OPENSHIFT_DATA_DIR
        echo "Downloading composer..."
        php -r "readfile('https://getcomposer.org/installer');" | php 
    fi
    
    $MY_PHPCOMPOSER -n -q self-update
    cd $OPENSHIFT_REPO_DIR 
    # install
    php -dmemory_limit=1G $MY_PHPCOMPOSER install
    

    Deploy Error

    Stopping PHP 5.4 cartridge (Apache+mod_php)
    Waiting for stop to finish
    Waiting for stop to finish
    Stopping MySQL 5.5 cartridge
    Stopping PHPMyAdmin cartridge
    Waiting for stop to finish
    Waiting for stop to finish
    Stopping Cron cartridge
    Repairing links for 1 deployments
    Building git ref 'develop', commit b3a5587
    Checking .openshift/pear.txt for PEAR dependency...
    Ignoring composer.lock file (development mode)
    Checking composer.json for Composer dependency...
    Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/var/lib/openshift/563b289089f5cfb439000159/php                                                                                  /usr/bin/composer self-update" to get the latest version.
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    
    
                                                                                                                                                                                                                                               
      [RuntimeException]                                                                                                                                                                                                                         
      Could not load package intervention/image in http://packagist.org: [UnexpectedValueException] Could not parse version constraint 4.x.x: Invalid version s                                                                                  tring "4.x.x"
                                                                                                                                                                                                                                                 
    
    
    
    
    
      [UnexpectedValueException]
      Could not parse version constraint 4.x.x: Invalid version string "4.x.x"
    
    
    
    update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [                                                                                  --no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [package                                                                                  s1] ... [packagesN]
    
    
    Starting MySQL 5.5 cartridge
    Starting PHPMyAdmin cartridge
    Starting Cron cartridge
    Starting PHP 5.4 cartridge (Apache+mod_php)
    Application directory "public/" selected as DocumentRoot
    An error occurred executing 'gear deploy' (exit code: 1)
    Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/563b289089f5cfb439000159/php
    
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/v2_cart_model.rb:1387:in `block in do_control_with_di                                                                                  rectory'
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/v2_cart_model.rb:1175:in `process_cartridges'
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/v2_cart_model.rb:1350:in `do_control_with_directory'
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/v2_cart_model.rb:1197:in `do_control'
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/application_container_ext/cartridge_actions.rb:586:in                                                                                   `build'
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/application_container_ext/cartridge_actions.rb:458:in                                                                                   `post_receive'
    /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.38.7/lib/openshift-origin-node/model/application_container_ext/cartridge_actions.rb:1035:i                                                                                  n `deploy'
    /usr/bin/gear:436:in `block (3 levels) in <main>'
    /usr/bin/gear:75:in `do_command'
    /usr/bin/gear:423:in `block (2 levels) in <main>'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in `call'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:155:in `run'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:385:in `run_active_command'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:74:in `run!'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/delegates.rb:11:in `run!'
    /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/import.rb:10:in `block in <top (required)>'
    
    opened by wreeecks 0
  • Fix to link new storage-directory correctly in subsequent deployments

    Fix to link new storage-directory correctly in subsequent deployments

    For subsequent deployments the storage directory needs to be removed completely. Without this change the default storage directory keeps existing and any log additions will be written to default storage/log directory and will be deleted in subsequent deployments.

    opened by basjac 0
  • How to link uploads folder?

    How to link uploads folder?

    Hi,

    After deploying the app, all the uploaded images were deleted or maybe moved to somewhere else. I'm not sure what's happening when i deploy something.

    How do I automatically link the uploads folder to the openshift data dir? or better if the files on the upload folders are preserved. I've tried adding a link command on deploy script but sadly it didn't work. Can you please assist me in setting this up. Thanks in advance!

    ln -sf ${OPENSHIFT_DATA_DIR}public/uploads   ${OPENSHIFT_REPO_DIR}public/uploads
    ln -sf ${OPENSHIFT_DATA_DIR}public/cards   ${OPENSHIFT_REPO_DIR}public/cards
    
    opened by wreeecks 5
  • artisan vendor:publish error

    artisan vendor:publish error

    Hi, When I want to add a custom class to the composer.json my custom class need to implement in config/app.php and after that need to artisan vendor:publish But when I want to commit my application, then I receive this message: deply2 deplyment

    I can resolve this error using this method:

    1. Login to the server using ssh
    2. Run a PHP artisan vendor:publish
    3. Restart the application

    That's all Regards Payam

    opened by khaninejad 0
Owner
Jacob Lucky
Jacob Lucky
Framework - 🙃 Phony. Real-like Fake Data Generation Framework

?? Framework This repository contains the ?? Phony Framework. ?? Start generating fake data with ?? Phony Framework, visit the main Phony Repository.

Phonyland 5 Oct 31, 2022
User to Team associations with invitation system for the Laravel 5 Framework

Teamwork This package supports Laravel 6 and above. Teamwork is the fastest and easiest method to add a User / Team association with Invites to your L

Marcel Pociot 983 Jan 2, 2023
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Livewire 17.7k Jan 1, 2023
Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework.

Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework. This rep

LaraBug 197 Dec 9, 2022
JSON-RPC 2.0 API server for @Laravel framework

Sajya is an open-source project aiming to implement the JSON-RPC 2.0 server specification for the Laravel quickly.

Sajya 179 Dec 29, 2022
Stapler-based file upload package for the Laravel framework.

laravel-stapler Laravel-Stapler is a Stapler-based file upload package for the Laravel framework. It provides a full set of Laravel commands, a migrat

Code Sleeve 565 Dec 9, 2022
SSLCommerz Payment gateway library for Laravel framework

SSLCommerz SSLCommerz Payment gateway library for Laravel framework. Official documentation is here. install composer require sam-asif/sslcommerz Pro

Md. Asif Iqbal 1 Oct 28, 2021
Extend Laravel PHP framework to make working with Aiven databases simpler

Aiven Commands for Laravel ✨ Add some Aiven magic to your Laravel project ✨ This Laravel package provides some aiven commands for artisan to help with

Aiven 8 Aug 19, 2022
Sistema Imobiliário utilizando o Framework PHP Laravel

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Pedro Leandro 1 Jan 11, 2022
Get started using SELCOM APIs with Laravel framework

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Bruno 2 Jan 13, 2022
Use Blade templates without the full Laravel framework

blade Use Laravel Blade templates as a standalone component without the full Laravel framework Full documentation is available at http://duncan3dc.git

Craig Duncan 138 Dec 7, 2022
In-browser console for Laravel PHP framework.

Laravel 4 Console In-browser console for Laravel 4 PHP framework. This bundle executes your code within ConsoleController@postExecute context, and dis

null 172 Dec 30, 2022
Integrasi Payment Gateway Midtrans dengan Framework Laravel 8

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Martin Mulyo Syahidin 25 Dec 4, 2022
A simple PHP package to show SweetAlerts with the Laravel Framework

Easy Sweet Alert Messages for Laravel Installation Require the package using Composer. composer require uxweb/sweet-alert If using laravel < 5.5 inclu

Uziel Bueno 824 Jan 7, 2023
Twitter clone project being developed by using PHP Laravel Framework and tailwind.css

Twits! About Twits! We, as enthusiastic learners and new developers, kicked of this project in order to improve our skills and capabilities in PhP Lar

Furkan Meraloğlu 10 Aug 29, 2022
The Laravel Framework.

About Laravel Note: This repository contains the core code of the Laravel framework. If you want to build an application using Laravel, visit the main

The Laravel Framework 28.6k Dec 31, 2022
Self-hosted CMS platform based on the Laravel PHP Framework.

October is a Content Management System (CMS) and web platform whose sole purpose is to make your development workflow simple again. It was born out of

October CMS 10.8k Jan 1, 2023
Powerful REPL for the Laravel framework.

Introduction Laravel Tinker is a powerful REPL for the Laravel framework. Official Documentation Documentation for Tinker can be found on the Laravel

The Laravel Framework 7.1k Jan 3, 2023
Fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger.

Laravel Headless What about? This allows a fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent R

Julien SCHMITT 6 Dec 30, 2022