Skip to content
Snippets Groups Projects
Commit 4d25db95 authored by RomanSteinberg's avatar RomanSteinberg
Browse files

Merge remote-tracking branch 'gitlab/deploy'

Conflicts:
	db/Makefile
parents 69ce0dda 7e0c022b
Branches
Tags
No related merge requests found
Showing
with 139 additions and 159 deletions
......@@ -9,6 +9,7 @@ db/disciplines activity.sql
!~dev_rating/static/img/
!~dev_rating/static/other/
node_modules/
/config
*.*~
*.DS_STORE
......
default: deploy
@
include ./config/path.makefile
install: DB_install Tasker_install Tasker_run
default: deploy
@
deploy: DB_deploy Tasker_deploy Tasker_run
# install local gulp and packages, empty db and static site files
install: DB_install Tasker_deploy
gulp install
@
# install local gulp and packages, update db routines and static site files
deploy: DB_deploy Tasker_deploy
gulp
# copy server files
copy_files: Tasker_deploy
gulp --release --force
rsync -ru --exclude="application/config" --exclude="news.md" --exclude="updates.md" \
\~dev_rating/ $(DST_PATH)
# server deploy without fix
release_no_fix: DB_deploy copy_files
Tasker_install: Tasker_deploy
npm install -g gulp
# server deploy with fix
release: DB_fix server_deploy
# server deploy with dump load
load_deploy: DB_deploy_test copy_files
# -----------------------
# Tasker section
Tasker_deploy:
npm install
Tasker_run:
gulp
# -----------------------
# database forwarding
DB_%:
@$(MAKE) $* -C ./db
@$(MAKE) $* -C ./db
\ No newline at end of file
......@@ -2,14 +2,40 @@ define GET_NAMES
$(subst .sql, , $(wildcard $1/*.sql))
endef
CONFIG_PATH = ../config/db.makefile
include $(CONFIG_PATH)
USER := $(shell bash -c 'read -p "Username: " username; echo $$username')
PASS := $(shell bash -c 'read -s -p "Password: " pwd; echo $$pwd')
DB := mmcs_rating
ifeq ($(DB),)
DB := $(shell bash -c 'read -p "Database: " db; echo $$db')
endif
ifeq ($(LOGIN),)
LOGIN := $(shell bash -c 'read -p "DB Username: " login; echo $$login')
endif
ifeq ($(PASS),)
PASS := $(shell bash -c 'read -s -p "DB Password: " pwd; echo $$pwd')
endif
FLAGS := -u $(LOGIN)
ifneq ($(PASS),)
ifneq ($(PASS),"")
FLAGS += --password=$(PASS)
endif
endif
ifneq ($(PORT),)
FLAGS += --port=$(PORT)
endif
ifneq ($(HOST),)
FLAGS += --host=$(HOST)
endif
install: $(call GET_NAMES, structure) \
default: deploy
@
install: \
clear \
$(call GET_NAMES, structure) \
$(call GET_NAMES, data) \
$(call GET_NAMES, constraints) \
deploy
......@@ -18,8 +44,29 @@ deploy
deploy: $(call GET_NAMES, stored)
@
fix: $(call GET_NAMES, fixes)
@
clear:
@ yes | mysqladmin $(FLAGS) drop $(DB) || true
@ mysqladmin $(FLAGS) create $(DB);
%:
mysql -u $(USER) --password=$(PASS) $(DB) < $@.sql
hideData:
@ echo "UPDATE accounts SET Password = sha1('11111'), \
ActivationCode= null, \
EMail= null" | mysql --database=$(DB) $(FLAGS)
deploy_test: \
clear \
../../mmcs_rating \
fix \
deploy \
hideData
update: \
deploy \
fix
%:
@ mysql --database=$(DB) $(FLAGS) < $@.sql
@ echo $@.sql
# LOGIN = root
# PASS = ""
# DB = mmcs_rating
# PORT = 3306
# HOST = 127.0.0.1
# DST_PATH =
File moved
File moved
File moved
File moved
File moved
File moved
......@@ -10,7 +10,7 @@ fi
if [ -z $2 ] || ![ -d $2 ]
then
d=~/public_html/
else
else
d=$2
fi
......@@ -22,4 +22,3 @@ cd ..
# old copy cp -rp ${s}~dev_rating/* $d
rsync -ru --exclude="java" ${s}~dev_rating/ $d/
cp ${s}~dev_rating/.htaccess ${d}/.htaccess
rm -rf ${d}/application/config
#source
if [ -z $1 ] || ![ -d $1 ]
then
s=~/grade-rating/
else
s=$1
fi
#destination
if [ -z $2 ] || ![ -d $2 ]
then
d=~/public_html/
else
d=$2
fi
#shopt -s dotglob
cp -rp ${s}~dev_rating/* $d
cp ${s}~dev_rating/.htaccess ${d}/.htaccess
rm -rf ${d}/application/config
echo -n "Enter password for mysql user 'mmcs_rating': "
read -s mysqlpswd
echo ""
yes | mysqladmin -u mmcs_rating -p$mysqlpswd drop mmcs_rating
mysqladmin -u mmcs_rating -p$mysqlpswd create mmcs_rating
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Structure.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredProcedures.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Sample.sql
......@@ -10,25 +10,24 @@ fi
if [ -z $2 ] || ![ -d $2 ]
then
d=~/data/
else
else
d=$2
fi
#shopt -s dotglob
rm -rf ${s}~dev_rating/application/config
rm -rf ${s}~dev_rating/application/news.md
rm -rf ${s}~dev_rating/application/updates.md
cp -rp ${s}~dev_rating/* $d
cp ${s}~dev_rating/.htaccess ${d}/.htaccess
rm -rf ${d}/application/config
echo -n "Enter password for mysql user 'mmcs_rating': "
read -s mysqlpswd
echo ""
yes | mysqladmin -u mmcs_rating -p$mysqlpswd drop mmcs_rating
mysqladmin -u mmcs_rating -p$mysqlpswd create mmcs_rating
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Structure.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredProcedures.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/release_gen_mmcs_sg.sql
cd ${s}/db
make deploy
cd ../../
sed -i 's/~dev_rating//g' ${d}.htaccess
sed -i 's/\/~dev_rating//g' ${d}application/bootstrap.php
sed -i 's/\/~dev_rating//g' ${d}media/js/config.js
chmod u=rwx,g=rx,o=r ./data/index.php
\ No newline at end of file
chmod u=rwx,g=rx,o=r ./data/index.php
#p - production
#s - sandbox
if [ -z $1 ]
then
s='s'
else
s=$1
fi
if [ $s != 's' ] && [ $s != 'p' ]
then
exit
fi
if [ $s = 's' ]
then
dep_script=deploy.sh
fi
if [ $s = 'p' ]
then
dep_script=deploy_release.sh
fi
rm -rf ~/grade-rating/
git clone http://itlab.mmcs.sfedu.ru/git/grade-rating ~/grade-rating/
cp ~/grade-rating/${dep_script} ./${dep_script}
chmod +x ./${dep_script}
./${dep_script}
......@@ -10,24 +10,12 @@ fi
if [ -z $2 ] || ![ -d $2 ]
then
d=~/public_html/
else
else
d=$2
fi
./copy.sh ${s} ${d}
echo -n "Enter password for mysql user 'mmcs_rating': "
read -s mysqlpswd
echo ""
yes | mysqladmin -u mmcs_rating -p$mysqlpswd drop mmcs_rating
mysqladmin -u mmcs_rating -p$mysqlpswd create mmcs_rating
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ./mmcs_rating.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/fix.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Views.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredFunctions.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredProcedures.sql
echo "UPDATE accounts SET Password = sha1('11111')" | mysql -u mmcs_rating -p$mysqlpswd mmcs_rating
echo "UPDATE accounts SET ActivationCode= null" | mysql -u mmcs_rating -p$mysqlpswd mmcs_rating
echo "UPDATE accounts SET EMail= null" | mysql -u mmcs_rating -p$mysqlpswd mmcs_rating
cd ${s}/db
make deploy_test
cd ../../
......@@ -10,17 +10,12 @@ fi
if [ -z $2 ] || ![ -d $2 ]
then
d=~/public_html/
else
else
d=$2
fi
./copy.sh ${s} ${d}
echo -n "Enter password for mysql user 'mmcs_rating': "
read -s mysqlpswd
echo ""
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/fix.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/Views.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredProcedures.sql
mysql -u mmcs_rating -p$mysqlpswd mmcs_rating < ${s}db/StoredFunctions.sql
cd ${s}/db
make update
cd ../../
......@@ -9,10 +9,12 @@ var varg = minimist(process.argv.slice(2), {
default: {env: process.env.NODE_ENV || 'debug'}
});
var options = {
opt: varg.env !== 'debug' || varg.release,
inc: !varg.force,
beauty: varg.beauty || varg.rainbow
opt: varg.env !== 'debug' || varg.release, // optimize
inc: !varg.force, // incremental build
beauty: varg.beauty || varg.rainbow,
dst: varg.dst
};
......@@ -44,15 +46,18 @@ var paths = new (function () {
var self = this;
self.root = '.';
var src = '.';
var dst = options.dst || self.root + '/~dev_rating';
var app = self.root + '/~dev_rating';
var media = self.root + '/media';
var stat = app + '/static';
var media = src + '/media';
var stat = dst + '/static';
self.src = {
css: media + '/css/**/*.css',
less: media + '/less/**/*.less',
js: media + '/js/**/*.js',
config: self.root + '/config/*',
config: src + '/deploy/phpConfig/*',
css_components: media + '/components/**/*.css',
js_components: media + '/components/**/*.js'
};
......@@ -62,7 +67,7 @@ var paths = new (function () {
css: stat + '/css/',
less: stat + '/css/',
js: stat + '/js/',
config: app + '/application/config/',
config: dst + '/application/config/',
css_components: stat + '/components/',
js_components: stat + '/components/'
};
......@@ -144,7 +149,7 @@ var constructTask = function (config) {
lazypipe().pipe(changed, config.dst, ext) :
empty;
gulp.src(config.src)
return gulp.src(config.src)
.pipe(chgPipe())
.pipe(midPipe())
.on('error', errorHandler)
......@@ -165,19 +170,19 @@ var constructWatch = function (config) {
gulp.task('less:compile', function () {
constructTask(getConfig('less'));
return constructTask(getConfig('less'));
});
gulp.task('css:copy', function () {
constructTask(getConfig('css'));
return constructTask(getConfig('css'));
});
gulp.task('js:copy', function () {
constructTask(getConfig('js'));
return constructTask(getConfig('js'));
});
gulp.task('config:copy', function () {
constructTask({
return constructTask({
src: paths.src.config,
dst: paths.dst.config
});
......@@ -185,7 +190,7 @@ gulp.task('config:copy', function () {
gulp.task('components:copy', function () {
constructTask(getConfig('css_components'));
constructTask(getConfig('js_components'));
return constructTask(getConfig('js_components'));
});
......@@ -196,11 +201,18 @@ gulp.task('folders:create', function () {
var dirs = [
app + '/logs/',
app + '/static/',
app + '/static/components/'
];
dirs.forEach(function (i) {
fs.mkdir(dirs[i]);
dirs.forEach(function (dir) {
try {
fs.mkdirSync(dir);
} catch (err) {
if (err.code !== 'EEXIST') {
throw err;
}
}
});
});
......
{
"name": "gulp",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"dependencies": {
"name": "GradeRatingSystem",
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-changed": "^1.2.1",
"gulp-autoprefixer": "^2.3.1",
......@@ -15,11 +14,5 @@
"lazypipe": "^1.0.1",
"gulp-uglify": "^1.2.0",
"minimist": "^1.1.1"
},
"devDependencies": {},
"scripts": {
"test": "gulp"
},
"author": "",
"license": "ISC"
}
}
Кафедра Алгебры и Дискретной Математики
Штейнберг Роман Борисович
Стребежев Игорь Алексеевич
Бегунков Павел
Кафедра Информатики и Вычислительного Эксперимента
Брагилевский Виталий Николаевич
Пеленицын Артём Михайлович
Сенченко Наталья Николаевна
Без кафедры
Энакин Скайуокер
Оби-Ван Кеноби
Мастер Йода
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment