Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
ng6
Commits
f4e94e99
Commit
f4e94e99
authored
Oct 15, 2013
by
Penom Nom
Browse files
Install pipeline of ng6 website
parent
493f3912
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
workflows/install/__init__.py
0 → 100644
View file @
f4e94e99
#
# Copyright (C) 2012 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from
subprocess
import
Popen
,
PIPE
from
jflow.workflow
import
Workflow
import
tempfile
,
os
,
sys
,
re
,
logging
from
ng6.config_reader
import
NG6ConfigReader
from
os.path
import
expanduser
class
Install
(
Workflow
):
def
process
(
self
):
#typo3 variables
db_host
=
"localhost"
db_user
=
"root"
db_password
=
"root"
db_name
=
"t3"
db_tmp_name
=
db_name
suffix_db
=
1
home_path
=
expanduser
(
"~"
)
if
"/"
.
join
(
sys
.
argv
[
0
].
split
(
"/"
)[:
-
2
])[
0
]
!=
"/"
:
ng6_path
=
str
(
os
.
getcwd
())
+
"/"
+
"/"
.
join
(
sys
.
argv
[
0
].
split
(
"/"
)[:
-
2
])
else
:
ng6_path
=
"/"
.
join
(
sys
.
argv
[
0
].
split
(
"/"
)[:
-
2
])
db_path
=
ng6_path
+
"/workflows/install/data_typo3/database.sql"
web_dir
=
"/var/www"
save_data_path
=
NG6ConfigReader
().
get_save_directory
()
+
"/data"
unzip_binary_path
=
""
install_tool_password
=
"typo3"
# install_tool_password_hash =""
# wget
dummy_tmp
=
tempfile
.
NamedTemporaryFile
(
prefix
=
'dummy_'
,
suffix
=
'.zip'
).
name
wget
=
[
"wget"
,
"--output-document"
,
dummy_tmp
,
"http://prdownloads.sourceforge.net/typo3/typo3_src+dummy-4.7.12.zip"
]
p
=
Popen
(
wget
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
# unzip
dummy_tmp_dir
=
tempfile
.
mkdtemp
(
suffix
=
'_typo3'
,
prefix
=
'dummy_'
)
unzip
=
[
"unzip"
,
dummy_tmp
,
"-d"
,
dummy_tmp_dir
]
p
=
Popen
(
unzip
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
#rename typo3 folder
typo3_dir
=
os
.
listdir
(
dummy_tmp_dir
)[
0
]
rename
=
[
"mv"
,
dummy_tmp_dir
+
"/"
+
typo3_dir
,
dummy_tmp_dir
+
"/ng62"
]
p
=
Popen
(
rename
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
#link ng6 folder
slink_ext
=
[
"ln"
,
"-s"
,
ng6_path
+
"/ui/nG6"
,
dummy_tmp_dir
+
"/ng62/typo3conf/ext/nG6"
]
p
=
Popen
(
slink_ext
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
mkdir_templ
=
[
"mkdir"
,
dummy_tmp_dir
+
"/ng62/fileadmin/templates"
]
p
=
Popen
(
mkdir_templ
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
slink_templ
=
[
"ln"
,
"-s"
,
ng6_path
+
"/ui/nG6template"
,
dummy_tmp_dir
+
"/ng62/fileadmin/templates/nG6template"
]
p
=
Popen
(
slink_templ
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
slink_data
=
[
"ln"
,
"-s"
,
save_data_path
,
dummy_tmp_dir
+
"/ng62/fileadmin/data"
]
p
=
Popen
(
slink_data
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
#create config file
with
open
(
dummy_tmp_dir
+
'/ng62/typo3conf/localconf.php'
)
as
f
:
config_lines
=
''
.
join
(
f
.
readlines
()[:
-
1
])
with
open
(
dummy_tmp_dir
+
'/ng62/typo3conf/localconf.php'
,
"w"
)
as
f
:
f
.
write
(
config_lines
)
#Set config variables for typo3
f
.
write
(
"$TYPO3_CONF_VARS['EXT']['extList'] = 'extbase,css_styled_content,info,perm,func,filelist,fluid,about,version,tsconfig_help,context_help,extra_page_cm_options,impexp,sys_note,tstemplate,tstemplate_ceditor,tstemplate_info,tstemplate_objbrowser,tstemplate_analyzer,func_wizards,wizard_crpages,wizard_sortpages,lowlevel,install,belog,beuser,aboutmodules,setup,taskcenter,info_pagetsconfig,viewpage,rtehtmlarea,t3skin,t3editor,reports,felogin,form,rsaauth,saltedpasswords,nG6';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['SYS']['compat_version'] = '4.7';
\n
"
)
f
.
write
(
"$typo_db_username = '"
+
db_user
+
"';
\n
"
)
f
.
write
(
"$typo_db_password = '"
+
db_password
+
"';
\n
"
)
f
.
write
(
"$typo_db_host = '"
+
db_host
+
"';
\n
"
)
f
.
write
(
"$typo_db = '"
+
db_name
+
"';
\n
"
)
#Risque de conflit si utilisation de l'installeur typo3
f
.
write
(
"$TYPO3_CONF_VARS['BE']['loginSecurityLevel'] = 'rsa';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['FE']['loginSecurityLevel'] = 'rsa';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['EXT']['extList_FE'] = 'extbase,css_styled_content,fluid,version,install,rtehtmlarea,t3skin,felogin,form,rsaauth,saltedpasswords,nG6';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['BE']['disable_exec_function'] = '0';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['GFX']['gdlib_png'] = '0';
\n
"
)
f
.
write
(
"$TYPO3_CONF_VARS['GFX']['im_combine_filename'] = 'composite';
\n
"
)
# hash du password typo3
p1
=
Popen
([
"echo"
,
"-n"
,
install_tool_password
],
stdout
=
PIPE
,
stderr
=
PIPE
)
p2
=
Popen
([
"md5sum"
],
stdin
=
p1
.
stdout
,
stdout
=
PIPE
)
p1
.
stdout
.
close
()
# Allow p1 to receive a SIGPIPE if p2 exits.
output
=
p2
.
communicate
()[
0
]
install_tool_password_hash
=
output
.
split
(
" "
)[
0
]
f
.
write
(
"$TYPO3_CONF_VARS['BE']['installToolPassword'] = '"
+
install_tool_password_hash
+
"';
\n
"
)
#test de presence unzip binary puis :
unzip_path
=
[
"which"
,
"unzip"
]
p
=
Popen
(
unzip_path
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
f
.
write
(
"$TYPO3_CONF_VARS['BE']['unzip_path'] = '"
+
stdout
.
rstrip
()
+
"';
\n
"
)
f
.
write
(
"?>
\n
"
)
# Enable install tool
install_file
=
[
"touch"
,
dummy_tmp_dir
+
'/ng62/typo3conf/ENABLE_INSTALL_TOOL'
]
p
=
Popen
(
install_file
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
#Checking if database name already exists
mysql_check_db
=
[
"mysql"
,
"--host="
+
db_host
,
"--user="
+
db_user
,
"--password="
+
db_password
,
"-e"
,
"SHOW DATABASES LIKE '"
+
db_name
+
"';"
]
p_mysql_check_db
=
Popen
(
mysql_check_db
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p_mysql_check_db
.
communicate
()
#Searching available name for typo3 database
while
stdout
!=
""
:
db_tmp_name
=
db_name
+
"_"
+
str
(
suffix_db
)
mysql_check_db
=
[
"mysql"
,
"--host="
+
db_host
,
"--user="
+
db_user
,
"--password="
+
db_password
,
"-e"
,
"SHOW DATABASES LIKE '"
+
db_tmp_name
+
"';"
]
p_mysql_check_db
=
Popen
(
mysql_check_db
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p_mysql_check_db
.
communicate
()
suffix_db
=
suffix_db
+
1
#Creating database typo3
db_name
=
db_tmp_name
mysql_create_db
=
[
"mysql"
,
"--host="
+
db_host
,
"--user="
+
db_user
,
"--password="
+
db_password
,
"-e"
,
"CREATE DATABASE "
+
db_name
+
";"
]
p
=
Popen
(
mysql_create_db
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
#Inserting tables in typo3 database
mysql_tables
=
[
"mysql"
,
"--host="
+
db_host
,
"--user="
+
db_user
,
"--password="
+
db_password
,
"--default-character-set=utf8"
,
"--database="
+
db_name
]
with
open
(
db_path
)
as
f
:
query
=
''
.
join
(
f
.
readlines
())
p
=
Popen
(
mysql_tables
,
stdout
=
PIPE
,
stderr
=
PIPE
,
stdin
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
(
query
)
# fix permissions typo3
chmod
=
[
"chmod"
,
"--recursive"
,
"777"
,
dummy_tmp_dir
+
'/ng62/typo3conf'
,
dummy_tmp_dir
+
'/ng62/fileadmin'
,
dummy_tmp_dir
+
'/ng62/typo3temp'
,
dummy_tmp_dir
+
'/ng62/uploads'
]
p
=
Popen
(
chmod
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
#cp typo3 folder to web folder
cp
=
[
"cp"
,
"-rf"
,
"--preserve=mode"
,
dummy_tmp_dir
+
"/ng62"
,
web_dir
]
p
=
Popen
(
cp
,
stdout
=
PIPE
,
stderr
=
PIPE
)
stdout
,
stderr
=
p
.
communicate
()
if
stderr
!=
""
:
logging
.
getLogger
(
"Install.process"
).
error
(
stderr
)
workflows/install/data_typo3/database.sql
0 → 100644
View file @
f4e94e99
This diff is collapsed.
Click to expand it.
workflows/install/data_typo3/parameters.info
0 → 100644
View file @
f4e94e99
#Default username and password for the nG6 website :
-> username : typo3
-> password : typo3
\ No newline at end of file
workflows/install/workflow.properties
0 → 100644
View file @
f4e94e99
#
# Copyright (C) 2012 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
[global]
name
=
install
description
=
install ng6 web site
#
# Parameter section
# param.name: the parameter display name
# .flag: the command line flag to use the argument
# .help: a brief description of what the parameter does
# .default [None]: the value produced if the parameter is not provided
# .type [str]: the parameter type that should be tested (str|int|date|file|bool)
# .choices [None]: a container of the allowable values for the parameter
# .required [False]: whether or not the command-line option may be omitted
# .action [store]: the basic type of action to be taken (store|append)
#
[parameters]
#db_name.flag = --db
#db_name.default = t3
#db_name.help = Name of typo3 database for nG6 website
#
#db_user.flag = --db-user
#db_user.default = admin
#db_user.help = Username to access the databases administrator (like phpmyadmin)
#
#db_password.flag = --db-pass
#db_password.default = password
#db_password.help = Password to access the databases administrator (like phpmyadmin)
#
#db_host.flag = --db-host
#db_host.default = localhost
#
db.host.help
=
Machine hosting the database
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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