abiao před 3 roky
rodič
revize
b9e833129b
6 změnil soubory, kde provedl 2 přidání a 210 odebrání
  1. 2 3
      .gitignore
  2. 0 13
      Dockerfile
  3. 0 28
      build.sh
  4. 0 3
      config/version.json
  5. 0 80
      run_unicorn.sh
  6. 0 83
      run_unicorn_docker.sh

+ 2 - 3
.gitignore

@@ -3,12 +3,11 @@
 .cache
 .DS_Store
 
-
-
 /build.sh
 /Dockerfile
 /run_unicorn_docker.sh
 /config/version.json
 /docker-compose.yml
-./log/
+log
+run_unicorn.sh
 

+ 0 - 13
Dockerfile

@@ -1,13 +0,0 @@
-# Version: 0.1
-FROM registry.cn-hongkong.aliyuncs.com/hiwavo/rails_env
-
-ARG CI_COMMIT_TAG
-ENV CI_COMMIT_TAG=$CI_COMMIT_TAG
-ENV PATH /root/.rbenv/bin:$PATH
-ADD ./ /home/rails/fohow/admin
-WORKDIR /home/rails/fohow/admin
-CMD rbenv exec bundle exec sh run_unicorn_docker.sh start
-
-
-
-

+ 0 - 28
build.sh

@@ -1,28 +0,0 @@
-#!/bin/bash
-# 项目名称(镜像名称)
-project_name='fohow_admin'
-# 获取项目版本号
-eval project_version=`jq .version ./config/version.json`
-# 获取git提交id
-#git_commit_id=`git log -1 --pretty=format:%h`
-git_commit_id=`date +%s`
-# 定义镜像标签
-#images_tag="${project_version}-${git_commit_id}"
-
-images_tag="latest"
-
-# 仓库地址
-images_hub='registry.cn-shenzhen.aliyuncs.com/fohow'
-
-# 构建镜像
-docker build --build-arg CI_COMMIT_TAG=${images_tag} -t ${images_hub}/${project_name}:${images_tag} .
-# 登录仓库
-#docker login ${images_hub}
-# 上传镜像
-docker push ${images_hub}/${project_name}:${images_tag}
-
-# 镜像清理
-docker rmi $(docker images -q -f dangling=true)
-
-echo "${images_hub}/${project_name}:${images_tag}"
-

+ 0 - 3
config/version.json

@@ -1,3 +0,0 @@
-{
-  "version": "v1.0.2"
-}

+ 0 - 80
run_unicorn.sh

@@ -1,80 +0,0 @@
-#!/bin/sh
-set -e
-# Example init script, this can be used with nginx, too,
-# since nginx and unicorn accept the same signals
-
-# Feel free to change any of the following variables for your app:
-TIMEOUT=${TIMEOUT-60}
-APP_ROOT=`pwd`
-PID=$APP_ROOT/tmp/pids/unicorn.pid
-PORT=6872
-#MODE=production
-MODE=development
-#MODE="test"
-#CMD="/usr/bin/unicorn -D -c $APP_ROOT/config/unicorn.rb"
-# bundle exec rake assets:precompile
-CMD="unicorn_rails -c $APP_ROOT/config/unicorn.rb -E $MODE -p $PORT -D"
-#INIT_CONF=$APP_ROOT/config/init.conf
-action="$1"
-set -u
-
-#test -f "$INIT_CONF" && . $INIT_CONF
-
-old_pid="$PID.oldbin"
-
-cd $APP_ROOT || exit 1
-
-sig () {
-	test -s "$PID" && kill -$1 `cat $PID`
-}
-
-oldsig () {
-	test -s $old_pid && kill -$1 `cat $old_pid`
-}
-
-case $action in
-start)
-	sig 0 && echo >&2 "Already running" && exit 0
-	$CMD
-	;;
-stop)
-	sig QUIT && exit 0
-	echo >&2 "Not running"
-	;;
-force-stop)
-	sig TERM && exit 0
-	echo >&2 "Not running"
-	;;
-restart|reload)
-	sig HUP && echo reloaded OK && exit 0
-	echo >&2 "Couldn't reload, starting '$CMD' instead"
-	$CMD
-	;;
-upgrade|r)
-	if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
-	then
-		n=$TIMEOUT
-		while test -s $old_pid && test $n -ge 0
-		do
-			printf '.' && sleep 1 && n=$(( $n - 1 ))
-		done
-		echo
-
-		if test $n -lt 0 && test -s $old_pid
-		then
-			echo >&2 "$old_pid still exists after $TIMEOUT seconds"
-			exit 1
-		fi
-		exit 0
-	fi
-	echo >&2 "Couldn't upgrade, starting '$CMD' instead"
-       #	$CMD
-	;;
-reopen-logs)
-	sig USR1
-	;;
-*)
-	echo >&2 "Usage: $0 <start|stop|restart|upgrade(r)|force-stop|reopen-logs>"
-	exit 1
-	;;
-esac

+ 0 - 83
run_unicorn_docker.sh

@@ -1,83 +0,0 @@
-#!/bin/sh
-set -e
-# Example init script, this can be used with nginx, too,
-# since nginx and unicorn accept the same signals
-
-# Feel free to change any of the following variables for your app:
-TIMEOUT=${TIMEOUT-60}
-APP_ROOT=`pwd`
-PID=$APP_ROOT/tmp/pids/unicorn.pid
-PORT=6876
-#MODE=production
-MODE=development
-#MODE="test"
-#CMD="/usr/bin/unicorn -D -c $APP_ROOT/config/unicorn.rb"
-# bundle exec rake assets:precompile
-#CMD="unicorn_rails -c $APP_ROOT/config/unicorn.rb -E $MODE -p $PORT -D"
-
-CMD="unicorn_rails -c $APP_ROOT/config/unicorn.rb -E $MODE -p $PORT"
-
-#INIT_CONF=$APP_ROOT/config/init.conf
-action="$1"
-set -u
-
-#test -f "$INIT_CONF" && . $INIT_CONF
-
-old_pid="$PID.oldbin"
-
-cd $APP_ROOT || exit 1
-
-sig () {
-	test -s "$PID" && kill -$1 `cat $PID`
-}
-
-oldsig () {
-	test -s $old_pid && kill -$1 `cat $old_pid`
-}
-
-case $action in
-start)
-	sig 0 && echo >&2 "Already running" && exit 0
-	$CMD
-	;;
-stop)
-	sig QUIT && exit 0
-	echo >&2 "Not running"
-	;;
-force-stop)
-	sig TERM && exit 0
-	echo >&2 "Not running"
-	;;
-restart|reload)
-	sig HUP && echo reloaded OK && exit 0
-	echo >&2 "Couldn't reload, starting '$CMD' instead"
-	$CMD
-	;;
-upgrade|r)
-	if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
-	then
-		n=$TIMEOUT
-		while test -s $old_pid && test $n -ge 0
-		do
-			printf '.' && sleep 1 && n=$(( $n - 1 ))
-		done
-		echo
-
-		if test $n -lt 0 && test -s $old_pid
-		then
-			echo >&2 "$old_pid still exists after $TIMEOUT seconds"
-			exit 1
-		fi
-		exit 0
-	fi
-	echo >&2 "Couldn't upgrade, starting '$CMD' instead"
-       #	$CMD
-	;;
-reopen-logs)
-	sig USR1
-	;;
-*)
-	echo >&2 "Usage: $0 <start|stop|restart|upgrade(r)|force-stop|reopen-logs>"
-	exit 1
-	;;
-esac