GithubHelp home page GithubHelp logo

vagrant-yii2's Introduction

Yii2 application vagrant box

Stack

  • ubuntu 12.04 32bits (precise32)
  • apache 2.4 mpm worker with fastcgi
  • php 5.5 fpm
  • mysql 5.5
  • curl & curl-php extension
  • memcached & memcache-php extension
  • composer
  • yii2 basic or advanced application

How to use

clone and init the vagrant box (you need Vagrant installed first)

$ git clone [email protected]:gusnips/vagrant-yii2.git
$ cd vagrant-yii2
$ vagrant up

ssh into the new box and create a new application

$ vagrant ssh
#Basic or advanced template? /var/www/bootstrap-basic.sh
$ sudo /var/www/bootstrap-advanced.sh

Add the domain of your new app to your hosts file

echo '33.33.33.34 yii2app.dev admin.yii2app.dev' | sudo tee -a /etc/hosts
#it will add this line to /etc/hosts
#33.33.33.34 yii2app.dev admin.yii2app.dev

use above whatever domain you wanted and the box ip in your Vagrantfile

Now access www.yii2app.dev and rock'n roll

What it does

  • it run composer to create a new app using yii2 advanced or basic template
  • creates a new mysql database and user for the new app
  • change default database values to use the new ones
  • change application cache to memcache
  • add a new apache hostname for frontend and backend applications

Default Options

Default box options. edit Vagrantfile to change it

  • domains= ["yii2app.dev", "www.yii2app.dev","admin.yii2app.dev"] Vagrant box hostname
  • ip= "33.33.33.34" Vagrant box IP
  • mysql_root_password="vagrant" Set mysql root password on installation

Default application options. Edit bootstap-advanced.sh to change it

  • mysql_root_password="vagrant" MySQL root password. The one you choose during installation.
  • domain="yii2app.dev" Domain to use.
  • domain_port="80" Port to use.
  • admin_domain="admin.yii2app.dev" Domain to use in admin. Advanced app only.
  • admin_domain_port="80" Port to use in admin. Advanced app only.
  • mysql_database="yii2app" New database name.
  • mysql_username="yii2app" MySQL username.
  • mysql_password="n3wp4ss" MySQL password.

optionally you can run the command passing the parameters

sudo /var/www/bootstap-basic.sh myp4ss mydomain.dev 80 appdb dbuser newp4ss

or for advanced template (in this order)

sudo /var/www/bootstap-advanced.sh myp4ss mydomain.dev 80 admin.mydomain.dev 80 appdb dbuser newp4ss

Remove a site

To completely remove a site run

sudo /var/www/remove-site.sh sitedomain.dev

It will undo everything bootstrap-advanced.sh and bootstrap-basic.sh did

*Use with caution

vagrant-yii2's People

Stargazers

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

Watchers

 avatar  avatar

vagrant-yii2's Issues

Installation problems - not sure if fatal or not

I am running a Mac OSX Yosemite with Virtual Box, Vagrant version 1.8.1

I followed instructions on the readme.MD file and got the following error when I ran /var/www/bootstrap-advanced.sh (sorry for size but I wanted to be detailed):

Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
Installing yiisoft/yii2-app-advanced (dev-master a34ba1e1bced7acd4edd7cc20eb9dab0aa725c4e)

  • Installing yiisoft/yii2-app-advanced (dev-master master)
    Downloading: 100%

Created project in /var/www/yii2app.dev
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- yiisoft/yii2 2.0.x-dev requires bower-asset/jquery.inputmask ~3.2.2 -> no matching package found.
- yiisoft/yii2 dev-master requires bower-asset/jquery.inputmask ~3.2.2 -> no matching package found.
- yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.
@stable | 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.@stable | 1.11.@stable -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.6 -> satisfiable by yiisoft/yii2[2.0.6, 2.0.7, 2.0.8, dev-master, 2.0.x-dev].

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
Yii Application Initialization Tool v1.0

Start initialization ...

generate backend/config/main-local.php
generate backend/config/params-local.php
generate backend/web/index-test.php
generate backend/web/index.php
generate common/config/main-local.php
generate common/config/params-local.php
generate console/config/main-local.php
generate console/config/params-local.php
generate frontend/config/main-local.php
generate frontend/config/params-local.php
generate frontend/web/index-test.php
generate frontend/web/index.php
generate tests/codeception/config/config-local.php
generate yii
generate cookie validation key in backend/config/main-local.php
generate cookie validation key in frontend/config/main-local.php
chmod 0777 backend/runtime
chmod 0777 backend/web/assets
chmod 0777 frontend/runtime
chmod 0777 frontend/web/assets
chmod 0755 yii
chmod 0755 tests/codeception/bin/yii

... initialization completed.

ERROR: Site yii2app.dev does not exist!

  • Reloading web server config apache2 [ OK ]
    PHP Warning: require(/var/www/yii2app.dev/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/yii2app.dev/yii on line 14
    PHP Fatal error: require(): Failed opening required '/var/www/yii2app.dev/vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/yii2app.dev/yii on line 14

All Done!

Now add the ip/domain to your hosts file if you didn't already. A little help:
echo '33.33.33.34 yii2app.dev www.yii2app.dev admin.yii2app.dev' | sudo tee -a /etc/hosts

Access your new sites http://yii2app.dev http://admin.yii2app.dev

Rock'n roll

network time out

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'precise32' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'precise32' (v0) for provider: virtualbox
default: Downloading: http://files.vagrantup.com/precise32.box
default: Download redirected to host: hashicorp-files.hashicorp.com
default:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

Failed to connect to hashicorp-files.hashicorp.com port 443: Timed out

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.