Created
September 9, 2016 17:24
-
-
Save felipemarques/d75ea860d0c66ee8eebe0decf4f8618f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 1) Requirements | |
* [nginx](https://www.nginx.com/) | |
* [php-fpm](http://php-fpm.org/) | |
* [php >= 5.5.x](http://php.net) | |
## 2) Install PHP & Nginx Environment on Ubuntu/Debian/Mint | |
``` | |
$ sudo apt-get install nginx -y && / | |
sudo apt-get install php5-fpm -y && / | |
sudo apt-get install php5-cli -y && / | |
sudo apt-get install php5-common -y && / | |
sudo apt-get install php5-curl -y && / | |
sudo apt-get install php5-json -y && / | |
sudo apt-get install php5-mcrypt -y && / | |
sudo apt-get install php5-mysql -y && / | |
sudo apt-get install php5-gd -y && / | |
sudo apt-get install php5-imagick -y && / | |
sudo apt-get install php-mbstring -y && / | |
sudo apt-get install php5-sqlite -y && / | |
echo "All php packages installed"; | |
``` | |
## 2.1) Install Redis Server | |
``` | |
$ sudo apt-get install redis-server redis-tools curl wget -y; | |
``` | |
## 2.2) Install MySQL | |
``` | |
$ sudo apt-get install mysql-server | |
``` | |
## 2.3) Install PhpMyAdmin (optional) | |
``` | |
$ sudo apt-get install phpmyadmin | |
``` | |
In step wizard dont select apache2 or lighttpd. | |
Select yes for dbcommon config. | |
Then use the following commands: | |
``` | |
$ sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html | |
$ sudo php5enmod mcrypt | |
$ sudo service php5-fpm restart | |
``` | |
1. copy the content file in [nginx-phpmyadmin.conf](https://github.com/jooxcards/JOOX.IO-API-ADMIN/blob/master/docs/nginx-phpmyadmin.conf) | |
2. Then substitute the conf file locate in: | |
``` | |
$ cd /etc/nginx/sites-enabled/ | |
$ sudo nano /etc/nginx/sites-enabled/00-default | |
$ sudo service nginx restart | |
``` | |
## 2.4) Install ImageMagick and RSVG Convert | |
``` | |
$ sudo apt-get install imagemagick -y | |
$ sudo apt-get install librsvg2-bin -y | |
``` | |
## 3) Install util packages | |
``` | |
$ sudo apt-get install curl -y; | |
$ sudo apt-get install wget -y; | |
``` | |
## 4) Install Composer | |
Go to site https://getcomposer.org/ for more instructions, or: | |
``` | |
$ cd ~/ | |
$ curl -sS https://getcomposer.org/installer | php | |
``` | |
or | |
``` | |
$ cd ~/ | |
$ php -r "readfile('https://getcomposer.org/installer');" | php | |
``` | |
Enable composer to run in any folder: | |
``` | |
$ sudo cp ./composer.phar /usr/bin/composer | |
``` | |
Test composer in joox.io folder projects: | |
``` | |
$ cd /var/www/joox.io/api_admin | |
$ composer | |
______ | |
/ ____/___ ____ ___ ____ ____ ________ _____ | |
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ | |
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / | |
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ | |
/_/ | |
Composer version 1.0-dev (a67eaf04c7eee3d10d7c64f3eef47995ec150ffe) 2015-07-30 12:14:55 | |
``` | |
Finally use composer for install dependencies stored in composer.json: | |
``` | |
$ composer install | |
``` | |
## 5) Local repository structure | |
``` | |
var | |
│ | |
└─── www | |
│ | |
├─── joox.io | |
│ │ | |
│ │─── api_admin | |
│ │ | |
│ │─── api_maker | |
│ │ | |
│ │─── maker | |
│ │ | |
│ │─── admin | |
│ │ | |
│ │─── platform_manager | |
``` | |
## 6) Configure Nginx | |
For configure Nginx in your local environment use the following config file: | |
1. copy the content file in [nginx-admin.api.joox.conf](https://github.com/jooxcards/JOOX.IO-API-ADMIN/blob/master/docs/nginx-admin.api.joox.conf) | |
2. Then substitute the conf file locate in: | |
``` | |
$ cd /etc/nginx/sites-enabled/ | |
$ sudo nano /etc/nginx/sites-enabled/admin.api.joox.conf | |
``` | |
## 7) Configure PHP-FPM | |
For configure PHP-FPM in your local environment use the following config file: | |
1. copy the content file in [php5-fpm-admin.api.joox.conf.conf](https://github.com/jooxcards/JOOX.IO-API-ADMIN/blob/master/docs/php5-fpm-nginx-admin.api.joox.conf) | |
2. Then substitute the conf file locate in: | |
``` | |
$ cd /etc/php5/fpm/pool.d/ | |
$ sudo rm -rf www.conf | |
$ sudo nano /etc/php5/fpm/pool.d/admin.api.joox.conf | |
``` | |
## 8) Configure Folder Permissions | |
Setting folder permissions on /var/www | |
``` | |
$ sudo chgrp -R www-data /var/www | |
$ sudo chown -R {your-user-here} /var/www/joox.io | |
$ sudo chmod g+s /var/www | |
``` | |
## 9) For each Laravel project (api_admin, api_maker, etc...) | |
Set the following permissions: | |
``` | |
$ cd /var/www/joox.io/api_admin | |
$ sudo chmod -R 777 bootstrap/cache | |
$ sudo chmod -R 777 storage/ | |
``` | |
``` | |
$ cd /var/www/joox.io/api_maker | |
$ sudo chmod -R 777 bootstrap/cache | |
$ sudo chmod -R 777 storage/ | |
``` | |
## 10) Configure Hosts | |
Configure your hosts file like this: | |
``` | |
127.0.0.1 localhost | |
127.0.0.1 admin.api.joox dev-admin.api.joox.io | |
127.0.0.1 maker.api.joox dev-maker.api.joox.io | |
127.0.0.1 test.api.joox | |
127.0.0.1 maker.joox dev-maker.joox.io | |
127.0.0.1 admin.joox dev-admin.joox.io | |
``` | |
## 11) Example .env | |
Configure your .env such as below: | |
``` | |
APP_ENV=local | |
APP_DEBUG=true | |
APP_KEY= | |
LOGIN_SESSION_EXPIRE_TIME=3600 | |
STRIPE_KEY= | |
STRIPE_SECRET= | |
DB_HOST=localhost | |
DB_PORT=3306 | |
DB_DATABASE=joox_admin | |
DB_USERNAME=root | |
DB_PASSWORD=q1w2e3 | |
DB_READ_HOST=localhost | |
DB_READ_PORT=3306 | |
DB_READ_DATABASE=joox_admin | |
DB_READ_USERNAME=joox_admin_read | |
DB_READ_PASSWORD=q1w2e3 | |
DB_WRITE_HOST=localhost | |
DB_WRITE_PORT=3306 | |
DB_WRITE_DATABASE=joox_admin | |
DB_WRITE_USERNAME=root | |
DB_WRITE_PASSWORD=q1w2e3 | |
TEST_DB_HOST=localhost | |
TEST_DB_PORT=3306 | |
TEST_DB_DATABASE=joox_admin | |
TEST_DB_USERNAME=root | |
TEST_DB_PASSWORD=q1w2e3 | |
JOOX_MAKER_DB_USER_READ_LOGIN= | |
JOOX_MAKER_DB_USER_READ_PASSWORD= | |
JOOX_MAKER_DB_HOST=localhost | |
JOOX_MAKER_DB_PORT=3306 | |
JOOX_MAKER_DB_READ_HOST=localhost | |
JOOX_MAKER_DB_WRITE_HOST=localhosts | |
JOOX_MAKER_DB_DATABASE=joox_maker | |
JOOX_MAKER_DB_USERNAME=root | |
JOOX_MAKER_DB_PASSWORD=q1w2e3 | |
CACHE_DRIVER=redis | |
SESSION_DRIVER=redis | |
QUEUE_DRIVER=database | |
BROADCAST_DRIVER=redis | |
MAIL_DRIVER=smtp | |
MAIL_HOST=smtp.gmail.com | |
MAIL_PORT=587 | |
MAIL_USERNAME= | |
MAIL_PASSWORD= | |
MAIL_ENCRYPTION=tls | |
APP_URL="http://admin.api.joox" | |
APP_ENDPOINT_FRONT="http://admin.joox" | |
APP_URL_RESET_PASSWORD="http://admin.joox/#/login/recovery/confirm" | |
APP_URL_SIGNUP="http://admin.joox/#/signup/confirm" | |
SESSION_PASSWORD_RESET_TOKEN_EXPIRATION_TIME=86400 | |
SESSION_LOGIN_EXPIRATION_TIME=86400 | |
AWS_ACCESS_KEY_ID= | |
AWS_SECRET_ACCESS_KEY= | |
AWS_REGION=us-west-2 | |
APP_COEFFICIENT_CALCULATE_DIRECTORY_LEVEL=1000 | |
APP_BUCKET_DEFAULT=test-api-v3 | |
APP_BUCKET_STATIC=test-api-v3 | |
APP_BUCKET_STATIC_ROOT= | |
APP_BUCKET_STATIC_REGION=us-west-2 | |
APP_BUCKET_ACCOUNT=test-api-v3 | |
APP_BUCKET_ACCOUNT_ROOT=account/avatar/ | |
APP_BUCKET_ACCOUNT_REGION=us-west-2 | |
APP_BUCKET_COMPANY=test-api-v3 | |
APP_BUCKET_COMPANY_ROOT=company/logo/ | |
APP_BUCKET_COMPANY_REGION=us-west-2 | |
APP_BUCKET_PRODUCT=test-api-v3 | |
APP_BUCKET_PRODUCT_ROOT=company/product/ | |
APP_BUCKET_PRODUCT_REGION=us-west-2 | |
APP_BUCKET_STORE=test-api-v3 | |
APP_BUCKET_STORE_ROOT=company/store/ | |
APP_BUCKET_STORE_REGION=us-west-2 | |
APP_BUCKET_DESIGN=test-api-v3 | |
APP_BUCKET_DESIGN_ROOT=design/ | |
APP_BUCKET_DESIGN_REGION=us-west-2 | |
APP_BUCKET_OUTPUTS=test-api-v3 | |
APP_BUCKET_OUTPUTS_ROOT=outputs/ | |
APP_BUCKET_OUTPUTS_REGION=us-west-2 | |
APP_BUCKET_COMMAND_LINE_IMPORT=test-api-v3 | |
APP_BUCKET_COMMAND_LINE_IMPORT_ROOT=command-line-import/ | |
APP_BUCKET_COMMAND_LINE_IMPORT_REGION=us-west-2 | |
SWAGGER_VERSION=2.0 | |
L5_SWAGGER_GENERATE_ALWAYS=true | |
L5_SWAGGER_API_AUTH_TOKEN=false | |
L5_SWAGGER_API_KEY_VAR=api_key | |
L5_SWAGGER_API_SECURITY_DEFINITION=api_key | |
L5_SWAGGER_API_KEY_INJECT=query | |
L5_SWAGGER_API_VERSION=1 | |
L5_SWAGGER_DEFAULT_API_VERSION=1 | |
DATABASE_REDIS_DEFAULT_HOST="127.0.0.1" | |
DATABASE_REDIS_DEFAULT_PORT=6379 | |
DATABASE_REDIS_DEFAULT_DATABASE=0 | |
#|--------------------------------------- | |
#| Cache configuration for object models | |
#|--------------------------------------- | |
Modules\ServiceOrder\Models\ServiceOrderStatus::CACHE_KEY_ALL_PAGINATE = allServiceOrderStatus | |
Modules\ServiceOrder\Models\ServiceOrderStatus::CACHE_TIMEOUT_ALL_PAGINATE = 0 | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment