Skip to content

Commit

Permalink
base: refine php
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron Zhang committed Sep 9, 2016
1 parent 90fbdec commit 5272386
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 77 deletions.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '2'
services:
nginx:
image: packageman/nginx:1.0.1
hostname: nginx
ports:
- "80:80"
volumes:
Expand All @@ -14,19 +15,26 @@ services:
restart: always
php:
image: packageman/php-supervisor-node-sass:1.0.1
hostname: php
volumes:
- /etc/nginx/site-enabled:/etc/nginx/site-enabled
- ../src:/src
- ../deploy:/deploy
- ./php-supervisor-node-sass/supervisor/conf:/etc/supervisor/conf.d
- ./php-supervisor-node-sass/bin:/root/bin
env_file: ./php-supervisor-node-sass/envfiles/stage.env
restart: always
redis:
image: packageman/redis:1.0.1
hostname: redis
ports:
- "6379:6379"
volumes:
- redis-data:/var/lib/redis
restart: always
mongodb:
image: packageman/mongodb:1.0.1
hostname: mongodb
ports:
- "27017:27017"
volumes:
Expand Down
74 changes: 0 additions & 74 deletions environment-setup.sh

This file was deleted.

4 changes: 1 addition & 3 deletions php-supervisor-node-sass/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ RUN mkdir -p /etc/service/supervisor
ADD supervisor/start.sh /etc/service/supervisor/run
RUN chmod +x /etc/service/supervisor/run

ADD templates /templates

WORKDIR /src

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /root/node-v0.12.2-linux-x64.tar.gz
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
44 changes: 44 additions & 0 deletions php-supervisor-node-sass/bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /bin/bash

set -e

cd /src

echo "install dependency"
npm install --registry=https://registry.npm.taobao.org

echo "replace gninx templates for env ${CURRENT_ENV}"
containerIp=`ifconfig eth0 | awk '/inet addr/{print substr($2,6)}'`
export PHP_FPM_HOST=${containerIp}

j2 ${NGINX_SITE_ADMIN_CONF_PATH} > /etc/nginx/site-enabled/${NGINX_SITE_ADMIN_NAME}.conf
j2 ${NGINX_SITE_API_CONF_PATH} > /etc/nginx/site-enabled/${NGINX_SITE_API_NAME}.conf

echo "replace config templates for env ${CURRENT_ENV}"
j2 /deploy/templates/config.php > common/config/config.php
j2 /deploy/templates/portalConfig.coffee > static/portal/coffee/config.coffee
j2 /deploy/templates/chatConfig.coffee > static/chat/config.coffee
j2 /src/modules/baomi/deploy/templates/config.php > /src/modules/baomi/backend/config/config.php

echo "run init"
php initStage
echo "generate translations"
node translate.js
echo "generate soft link for external module"
grunt linkmodule
echo "run grunt clean and build"
grunt cbuild
echo "scan modules"
php yii module/scan
echo "add account menus and mods"
php yii management/account/add-menus-and-mods
echo "ensure mongo indexes"
php yii management/index
echo "ensure cron resque job"
php yii management/job/init 1
echo "add the default sensitive operation to all accounts"
php yii management/sensitive-operation/index
echo "run migration"
php yii baomi/migration/perform

echo "Done!"

0 comments on commit 5272386

Please sign in to comment.