GithubHelp home page GithubHelp logo

httpd24_php56_opsworks's Introduction

httpd24_php56_opsworks

This repository is Chef Cookbooks for AWS OpsWorks Custom layer.

Support for PHP 5.6 and Apache 2.4 and PHP Application deployment.

  • Note: This recipes tested on Amazon Linux version: Amazon Linux 2015.03

This cookbooks use apache2 php composer recipes retrieved from Chef Supermarket via Berkshelf.

Initial Stack Setup

  1. Add a new stack
  2. Under Advanced Settings:
    • Pick chef version 11.10 as the chef version
    • Use custom cookbook pointing to https://github.com/yoshida/httpd24_php56_opsworks.git
    • Enable "Manage Berkshelf" with 3.2.0 as the version
    • Edit "Custom JSON" (refer to Stack Custom JSON section)
  3. Add a new Custom -> Custom layer.
  • Name: PHP5.6 App Server (as you like)
  • Short name: php56app (as you like)
  1. Edit the newly created layer, and add the custom recipes:
  • Setup: apache2 php apache2::mod_php5 composer
    • Note: If you want to use https, add the apache2::mod_ssl recipe, and add 443 to apache.listen_ports in Stack Custom JSON.
    • Note: composer is optional recipe if you want to use composer
    • Note: prompt is optional recipe for display stack name to Prompt String (PS1)
  • Configure: php::configure
  • Deploy: deploy::php-deploy
    • Note: deploy::laravel5-deploy is optional recipe for Laravel 5.1 initial configuration (composer required)
      • You can customize .env configuration with laravel5_deploy.dotenv object in Stack Custom JSON (The .env file copied from .env.example file, and replace key=value pair in .env file by laravel5_deploy.dotenv object's key-value pair).
    • Note: deploy::laravel5-migrate, deploy::laravel5-migrate-refresh are optional recipes for database migration.
  • Undeploy: deploy::php-undeploy

Stack Custom JSON

{
  "apache": {
    "package": "httpd24",
    "service_name": "httpd",
    "version": "2.4",
    "lock_dir": "/var/run/httpd",
    "default_site_enabled": false,
    "listen_addresses": ["*"],
    "listen_ports": ["80"]
  },
  "php": {
    "packages": [
      "php56",
      "php56-devel",
      "php56-mcrypt",
      "php56-mbstring",
      "php56-gd",
      "php56-bcmath",
      "php56-tidy",
      "php56-pdo",
      "php56-mysqlnd",
      "php56-pecl-memcached",
      "php56-pecl-apcu",
      "php56-opcache"
    ],
    "directives": {
      "error_log": "/var/log/httpd/php_errors.log"
    }
  },
  "laravel5_deploy": {
    "dotenv": {
      "APP_ENV": "production",
      "APP_DEBUG": false
    }
  }
}

Sample phpinfo apps setup

If you want to try deployment, we provide a sample application that displays phpinfo.

  1. Add a new application from the "Apps" section
  2. Under Settings:
    • Name: phpinfo
    • Type: PHP
    • Document root: public
    • Data source type: None
    • Repository URL: https://github.com/yoshida/phpinfo.git
  3. Deploy phpinfo application
  4. Open http://[your-server]/phpinfo.php

Sample wiki apps setup

If you want to try deployment another application, let's try to deploy the https://github.com/Stolz/Wiki application. This application developed with Laravel 5.1 and database. You must set up the MySQL instance before create Apps.

  1. Add a new DB -> MySQL layer.
  2. Edit the created MySQL layer, and add Custom JSON (workaround to avoid fail when deploy): { "mysql": { "mysql_bin": "/usr/bin/mysql" } }
  3. Add instance to MySQL Layer, and start instance.

Next, Set up the PHP5.6 App Server layer.

  1. Add a new Custom -> Custom layer if you don't create PHP5.6 App Server layer yet.
  • Name: PHP5.6 App Server (as you like)
  • Short name: php56app (as you like)
  1. Edit the PHP5.6 App Server layer, and set the custom recipes:
  • Setup: apache2 php apache2::mod_php5 apache2::mod_ssl composer prompt
  • Configure: php::configure
  • Deploy: deploy::php-deploy deploy::laravel5-deploy
  • Undeploy: deploy::php-undeploy
  1. Add instance to PHP5.6 App Server Layer, and start instance.

Next, Set up the Apps.

  1. Add a new application from the "Apps" section
  2. Under Settings:
    • Name: wiki
    • Type: PHP
    • Document root: public
    • Data source type: OpsWorks
      • Database instance: db-master1
      • Database name: wiki (as you like)
    • Repository URL: https://github.com/Stolz/Wiki.git
    • Enable SSL: Yes
      • SSL certificate: paste the your ssl certificate
      • SSL certificate key: paste your ssl certificate key
  3. Edit Stack Custom JSON:
{
  "apache": {
    "package": "httpd24",
    "service_name": "httpd",
    "version": "2.4",
    "lock_dir": "/var/run/httpd",
    "default_site_enabled": false,
    "listen_addresses": ["*"],
    "listen_ports": [80,443]
  },
  "php": {
    "packages": [
      "php56",
      "php56-devel",
      "php56-mcrypt",
      "php56-mbstring",
      "php56-gd",
      "php56-bcmath",
      "php56-tidy",
      "php56-pdo",
      "php56-mysqlnd",
      "php56-pecl-memcached",
      "php56-pecl-apcu",
      "php56-opcache"
    ],
    "directives": {
      "error_log": "/var/log/httpd/php_errors.log"
    }
  },
  "laravel5_deploy": {
    "dotenv": {
      "APP_ENV": "development",
      "APP_DEBUG": true,
      "APP_KEY": "your-application-key",
      "FACEBOOK_OAUTH_CLIENT_ID": "your-id",
      "FACEBOOK_OAUTH_CLIENT_SECRET": "your-secret",
      "GITHUB_OAUTH_CLIENT_ID": "your-id",
      "GITHUB_OAUTH_CLIENT_SECRET": "your-secret",
      "GOOGLE_OAUTH_CLIENT_ID": "your-id",
      "GOOGLE_OAUTH_CLIENT_SECRET": "your-secret",
      "TWITTER_OAUTH_CLIENT_ID": "your-id",
      "TWITTER_OAUTH_CLIENT_SECRET": "your-secret"
    }
  }
}
  1. Deploy wiki application
  2. Execute the deploy::laravel5-migrate-refresh recipe from Stack -> Run Command -> Execute Recipes on PHP 5.6 instance
  3. Open http://[your-server]/

If you cannot access the application, check these log files:

  • /srv/www/wiki/current/storage/logs/*.log
  • /var/log/httpd/wiki-error.log
  • /var/log/httpd/error.log
  • /var/log/httpd/php_errors.log

httpd24_php56_opsworks's People

Contributors

yoshida avatar shinichiro-yoshida avatar

Stargazers

Makoto Yoshioka avatar  avatar Wes Turner-Harris avatar Yuya Ma'emichi avatar Andrew avatar Daniel Aineah avatar Troy Montour avatar Franz Thüs avatar

Watchers

 avatar James Cloos avatar Troy Montour avatar

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.