Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
2cf5e8f6
Commit
2cf5e8f6
authored
Oct 25, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup and rewrite
parent
15a732c2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
60 deletions
+70
-60
base.task.sample
vz/azbyka/base.task.sample
+16
-0
createbytask.int.sh
vz/azbyka/createbytask.int.sh
+14
-8
createbytask.sh
vz/azbyka/createbytask.sh
+17
-28
functions
vz/azbyka/functions
+23
-23
runbytask.sh
vz/azbyka/runbytask.sh
+0
-1
No files found.
vz/azbyka/base.task.sample
View file @
2cf5e8f6
...
...
@@ -31,3 +31,19 @@ SERVICES="crond"
A2ENMOD="mod_php7 status mpm_itk remoteip setenvif rewrite session include"
# A2DISMOD=
# for every task
# required:
# VEID - unique ID (formely container ID, it is source for IP, for port)
# can be overrided:
# NAME - project name (get from filename if empty)
# AUSER - system user (only from standalone projects)
# STANDALONE - not subproject on BASESITE
# TODO: detect by dots in name?
# ADOMAIN - domain (don't used) like name.site.azbyka.ru (real domain for standalone site)
# ACONF - config name (usually the same like name) for nginx and apache
# VEIP - IP of the container
# HOSTHOME - host dir for home
vz/azbyka/createbytask.int.sh
View file @
2cf5e8f6
...
...
@@ -28,9 +28,6 @@ assure $ACONF
assure
$ADOMAIN
assure
$VEID
# Выделяем начальное слово в домене
FDOMAINPART
=
"
$(
echo
"
$ADOMAIN
"
|
sed
-e
"s|
\.
.*||"
)
"
# TODO: external config
ADMINEMAIL
=
lav@etersoft.ru
...
...
@@ -161,9 +158,9 @@ check process httpd2 with pidfile /var/run/httpd2/httpd.pid
stop program = "/sbin/service httpd2 stop"
# stop program = "/usr/local/sbin/stophttpd2"
if failed host localhost port 80 protocol http
and request "/server-status" timeout 10 seconds 2 times within 3 cycles then alert
and request "/server-status
/
" timeout 10 seconds 2 times within 3 cycles then alert
if failed host localhost port 80 protocol http
and request "/server-status" timeout 20 seconds 3 times within 4 cycles then restart
and request "/server-status
/
" timeout 20 seconds 3 times within 4 cycles then restart
EOF
# TODO: enable /server-status for localhost/server-status
...
...
@@ -204,7 +201,7 @@ tune_apache2()
# See https://bugzilla.altlinux.org/show_bug.cgi?id=39115
local
F
=
/etc/httpd2/conf/mods-start.d/090-etersoft-default.conf
truncate
$F
truncate
-s0
$F
for
i
in
$A2ENMOD
;
do
docmd a2enmod
$i
...
...
@@ -217,7 +214,7 @@ tune_apache2()
done
F
=
/etc/httpd2/conf/extra-start.d/090-etersoft-default.conf
truncate
$F
truncate
-s0
$F
for
i
in
httpd-multilang-errordoc
;
do
docmd a2disextra
$i
echo
"
$i
=no"
>>
$F
...
...
@@ -234,7 +231,7 @@ EOF
cp
/tmp/prepend.php /etc/httpd2/conf/include/prepend.php
||
fatal
# TODO
if
[
-s
/tmp/
$ACONF
.conf
]
;
then
if
true
||
[
-s
/tmp/
$ACONF
.conf
]
;
then
cp
/tmp/
$ACONF
.conf /etc/httpd2/conf/sites-enabled/
$ACONF
.conf
||
fatal
subst
"s|^NameVirtualHost.*||g"
/etc/httpd2/conf/sites-enabled/
$ACONF
.conf
subst
"s|^<VirtualHost.*|<VirtualHost *:80>|g"
/etc/httpd2/conf/sites-enabled/
$ACONF
.conf
...
...
@@ -337,6 +334,12 @@ EOF
serv httpd2 restart
||
fatal
}
tune_local_memcached_redis
()
{
serv redis on
serv memcached on
}
tune_php7_fpm
()
{
# /etc/fpm7/php-fpm.d/mediawiki.conf
...
...
@@ -379,6 +382,7 @@ for i in $PKGPROFILE ; do
epmi
--auto
--skip-installed
$PHP7BASE
tune_php /etc/php/7.?/apache2-mod_php/php.ini
tune_apache2
tune_local_memcached_redis
tune_monit_apache2
;;
apache2-php7-mediawiki
)
...
...
@@ -389,6 +393,7 @@ for i in $PKGPROFILE ; do
epmi
--auto
--skip-installed
$PHP7BASE
tune_php /etc/php/7.1/apache2-mod_php/php.ini
tune_apache2_mediawiki
tune_local_memcached_redis
tune_monit_apache2
;;
apache2-php5
)
...
...
@@ -402,6 +407,7 @@ for i in $PKGPROFILE ; do
# missed: intl yaml xdebug tidy
epmi
--auto
--skip-installed
$PHP7BASE
tune_php7_fpm
tune_local_memcached_redis
;;
esac
done
...
...
vz/azbyka/createbytask.sh
View file @
2cf5e8f6
...
...
@@ -121,44 +121,33 @@ if [ -z "$DOCKID" ] ; then
fi
# common projects (copy from base container)
if
[
-n
"
$VEIDORIG
"
]
;
then
# copy nginx config from a06
if
[
!
-s
"/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
.conf"
]
&&
[
-n
"
$STANDALONE
"
]
;
then
# copy nginx config from old server
if
false
&&
[
!
-s
"/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
.conf"
]
&&
[
-z
"
$STANDALONE
"
]
;
then
hostserver
cat
/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
.conf |
sed
-e
"s|/home/|/azbyka/|"
>
/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
.conf
hostserver
cat
/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
-manual
.conf |
sed
-e
"s|/home/|/azbyka/|"
>
/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
-manual
.conf
[
-s
/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
-manual
.conf
]
||
rm
-f
/etc/nginx/sites-enabled.d/azbyka.d/
$NAME
-manual
.conf
hostserver
cat
/etc/nginx/include/static-fallback-
$NAME
.conf
>
/etc/nginx/include/static-fallback-
$NAME
.conf
fi
# hack
#VEPORT=$(printf "%03d" $(($VEID-100)))
#cat <<EOF > /etc/nginx/httpconf-enabled.d/upstream_$ACONF.conf
## for site $ADOMAIN/$NAME
#upstream sites8$VEPORT {
# server $VEIP;
#}
#EOF
serv nginx reload
serv nginx reload
#if [ ! -s "apache/$ACONF.conf" ] ; then
# hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf > apache/$ACONF.conf
#fi
#if [ ! -s "apache/$ACONF.conf" ] ; then
# hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf > apache/$ACONF.conf
#fi
if
[
-s
apache/
$ACONF
.conf
]
;
then
cat
apache/
$ACONF
.conf | st
tee
/tmp/
$ACONF
.conf
>
/dev/null
else
echo
"Empty apache/
$ACONF
.conf, skipped"
#if [ ! -s apache/prepend.php ] ; then
# hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php > apache/prepend.php
#fi
fi
#if [ ! -s apache/prepend.php ] ; then
# hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php > apache/prepend.php
#fi
cat
apache/prepend.php | st
tee
/tmp/prepend.php
>
/dev/null
st
test
-s
/tmp/prepend.php
||
fatal
"Empty prepend.php
"
# TODO: generate apache config inside...
if
[
-s
apache/
$ACONF
.conf
]
;
then
cat
apache/
$ACONF
.conf | st
tee
/tmp/
$ACONF
.conf
>
/dev/null
else
fatal
"Empty apache/
$ACONF
.conf, skipped
"
fi
cat
apache/prepend.php | st
tee
/tmp/prepend.php
>
/dev/null
st
test
-s
/tmp/prepend.php
||
fatal
"Empty prepend.php"
# copy task into
ATASK
=
/tmp/
$(
basename
$TASK
)
(
[
-s
"base.task"
]
&&
cat
base.task
;
echo
;
cat
$TASK
;
)
| st
tee
$ATASK
>
/dev/null
...
...
vz/azbyka/functions
View file @
2cf5e8f6
...
...
@@ -27,7 +27,8 @@ hostserver()
load_config
()
{
TASK
=
"
$1
"
PKGINSTALL
=
PKGINSTALL
=
''
STANDALONE
=
''
if
[
-s
"base.task"
]
;
then
.
./base.task
...
...
@@ -42,39 +43,38 @@ fi
# TODO
[
-n
"
$VEIP
"
]
||
VEIP
=
$BASEIP
.
$VEID
STANDALONE
=
''
# Если не указан системный пользователь AUSER, считаем, что это отдельный проект
if
[
-z
"
$AUSER
"
]
;
then
STANDALONE
=
1
if
[
-n
"
$BASENAME
"
]
;
then
AUSER
=
${
BASENAME
}
_
$NAME
ADOMAIN
=
"
$NAME
.
$DOMAIN
"
ACONF
=
"
$AUSER
"
else
AUSER
=
"
$NAME
"
ADOMAIN
=
"
$NAME
.
$DOMAIN
"
ACONF
=
"
$AUSER
"
fi
# Если указан системный пользователь AUSER или указано STANDALONE, что это отдельный проект на домене
[
-n
"
$AUSER
"
]
&&
STANDALONE
=
1
||
AUSER
=
"
$NAME
"
# Проект на BASESITE (с префиксом BASENAME при его наличии)
if
[
-z
"
$STANDALONE
"
]
;
then
[
-n
"
$BASENAME
"
]
&&
AUSER
=
${
BASENAME
}
_
$NAME
ADOMAIN
=
"
$NAME
.
$DOMAIN
"
ACONF
=
"
$AUSER
"
fi
#
TODO
:
#
Не используется
:
# Если домен не был явно задан в конфиге, берём из NAME
if
[
-z
"
$ADOMAIN
"
]
;
then
ADOMAIN
=
"
$NAME
"
fi
[
-n
"
$ADOMAIN
"
]
||
ADOMAIN
=
"
$NAME
"
# Если название конфига явно не задано, берём из NAME
if
[
-z
"
$ACONF
"
]
;
then
ACONF
=
"
$NAME
"
fi
# Если название конфига явно не задано
[
-n
"
$ACONF
"
]
||
ACONF
=
"site_
$AUSER
"
[
-
n
"
$HOSTHOME
"
]
||
HOSTHOME
=
/
$BASENAME
[
-
z
"
$HOSTHOME
"
]
&&
[
-n
"
$BASENAME
"
]
&&
HOSTHOME
=
/
$BASENAME
# system user
assure
$AUSER
# domain (don't used) like name.site.azbyka.ru
assure
$ADOMAIN
# config name (usually the same like name) for nginx and apache
assure
$ACONF
# project name
assure
$NAME
# unique ID (formely container ID, it is source for IP, for port)
assure
$VEID
# IP of the container
assure
$VEIP
# host dir for home
assure
$HOSTHOME
}
vz/azbyka/runbytask.sh
View file @
2cf5e8f6
...
...
@@ -33,7 +33,6 @@ AUSER=azbyka_$NAME
assure
$NAME
assure
$VEID
#assure $VEIDORIG
st
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment