annotate toolfactory/docker/startup @ 46:f8700bed1e17 draft

Uploaded
author fubar
date Tue, 18 Aug 2020 08:25:43 -0400
parents f8c1694190f0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
1 #!/usr/bin/env bash
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
2
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
3 # Migration path for old images that had the tool_deps under /export/galaxy-central/tool_deps/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
4
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
5 if [ -d "/export/galaxy-central/tool_deps/" ] && [ ! -L "/export/galaxy-central/tool_deps/" ]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
6 mkdir -p /export/tool_deps/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
7 mv /export/galaxy-central/tool_deps /export/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
8 ln -s /export/tool_deps/ $GALAXY_ROOT/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
9 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
10
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
11 # This is needed for Docker compose to have a unified alias for the main container.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
12 # Modifying /etc/hosts can only happen during runtime not during build-time
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
13 echo "127.0.0.1 galaxy" >> /etc/hosts
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
14
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
15 # Set number of Galaxy handlers via GALAXY_HANDLER_NUMPROCS or default to 2
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
16 ansible localhost -m ini_file -a "dest=/etc/supervisor/conf.d/galaxy.conf section=program:handler option=numprocs value=${GALAXY_HANDLER_NUMPROCS:-2}" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
17
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
18 # If the Galaxy config file is not in the expected place, copy from the sample
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
19 # and hope for the best (that the admin has done all the setup through env vars.)
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
20 if [ ! -f $GALAXY_CONFIG_FILE ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
21 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
22 # this should succesfully copy either .yml or .ini sample file to the expected location
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
23 cp /export/config/galaxy${GALAXY_CONFIG_FILE: -4}.sample $GALAXY_CONFIG_FILE
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
24 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
25
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
26 # Configure proxy prefix filtering
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
27 if [[ ! -z $PROXY_PREFIX ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
28 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
29 if [ ${GALAXY_CONFIG_FILE: -4} == ".ini" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
30 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
31 ansible localhost -m ini_file -a "dest=${GALAXY_CONFIG_FILE} section=filter:proxy-prefix option=prefix value=${PROXY_PREFIX}" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
32 ansible localhost -m ini_file -a "dest=${GALAXY_CONFIG_FILE} section=app:main option=filter-with value=proxy-prefix" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
33 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
34 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} regexp='^ module:' state=absent" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
35 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} regexp='^ socket:' state=absent" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
36 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} regexp='^ mount:' state=absent" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
37 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} regexp='^ manage-script-name:' state=absent" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
38 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} insertafter='^uwsgi:' line=' manage-script-name: true'" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
39 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} insertafter='^uwsgi:' line=' mount: ${PROXY_PREFIX}=galaxy.webapps.galaxy.buildapp:uwsgi_app()'" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
40 ansible localhost -m lineinfile -a "path=${GALAXY_CONFIG_FILE} insertafter='^uwsgi:' line=' socket: unix:///srv/galaxy/var/uwsgi.sock'" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
41
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
42 # Also set SCRIPT_NAME. It's not always necessary due to manage-script-name: true in galaxy.yml, but it makes life easier in this container + it does no harm
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
43 ansible localhost -m lineinfile -a "path=/etc/nginx/conf.d/uwsgi.conf regexp='^ uwsgi_param SCRIPT_NAME' state=absent" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
44 ansible localhost -m lineinfile -a "path=/etc/nginx/conf.d/uwsgi.conf insertafter='^ include uwsgi_params' line=' uwsgi_param SCRIPT_NAME ${PROXY_PREFIX};'" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
45 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
46
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
47 ansible localhost -m ini_file -a "dest=${GALAXY_CONFIG_DIR}/reports_wsgi.ini section=filter:proxy-prefix option=prefix value=${PROXY_PREFIX}/reports" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
48 ansible localhost -m ini_file -a "dest=${GALAXY_CONFIG_DIR}/reports_wsgi.ini section=app:main option=filter-with value=proxy-prefix" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
49
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
50 # Fix path to html assets
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
51 ansible localhost -m replace -a "dest=$GALAXY_CONFIG_DIR/web/welcome.html regexp='(href=\"|\')[/\\w]*(/static)' replace='\\1${PROXY_PREFIX}\\2'" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
52
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
53 # Set some other vars based on that prefix
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
54 if [ "x$GALAXY_CONFIG_COOKIE_PATH" == "x" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
55 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
56 export GALAXY_CONFIG_COOKIE_PATH="$PROXY_PREFIX"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
57 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
58 if [ "x$GALAXY_CONFIG_DYNAMIC_PROXY_PREFIX" == "x" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
59 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
60 export GALAXY_CONFIG_DYNAMIC_PROXY_PREFIX="$PROXY_PREFIX/gie_proxy"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
61 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
62
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
63 # Change the defaults nginx upload/x-accel paths
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
64 if [ "$GALAXY_CONFIG_NGINX_UPLOAD_PATH" == "/_upload" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
65 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
66 export GALAXY_CONFIG_NGINX_UPLOAD_PATH="${PROXY_PREFIX}${GALAXY_CONFIG_NGINX_UPLOAD_PATH}"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
67 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
68 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
69
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
70 # Disable authentication of Galaxy reports
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
71 if [[ ! -z $DISABLE_REPORTS_AUTH ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
72 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
73 # disable authentification
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
74 echo "Disable Galaxy reports authentification "
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
75 echo "" > /etc/nginx/conf.d/reports_auth.conf
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
76 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
77 # enable authentification
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
78 echo "Enable Galaxy reports authentification "
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
79 cp /etc/nginx/conf.d/reports_auth.conf.source /etc/nginx/conf.d/reports_auth.conf
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
80 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
81
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
82 # Try to guess if we are running under --privileged mode
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
83 if [[ ! -z $HOST_DOCKER_LEGACY ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
84 if mount | grep "/proc/kcore"; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
85 PRIVILEGED=false
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
86 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
87 PRIVILEGED=true
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
88 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
89 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
90 # Taken from http://stackoverflow.com/questions/32144575/how-to-know-if-a-docker-container-is-running-in-privileged-mode
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
91 ip link add dummy0 type dummy 2>/dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
92 if [[ $? -eq 0 ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
93 PRIVILEGED=true
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
94 # clean the dummy0 link
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
95 ip link delete dummy0 2>/dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
96 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
97 PRIVILEGED=false
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
98 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
99 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
100
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
101 cd $GALAXY_ROOT
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
102 . $GALAXY_VIRTUAL_ENV/bin/activate
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
103
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
104 if $PRIVILEGED; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
105 umount /var/lib/docker
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
106 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
107
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
108 if [[ ! -z $STARTUP_EXPORT_USER_FILES ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
109 # If /export/ is mounted, export_user_files file moving all data to /export/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
110 # symlinks will point from the original location to the new path under /export/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
111 # If /export/ is not given, nothing will happen in that step
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
112 echo "Checking /export..."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
113 python3 /usr/local/bin/export_user_files.py $PG_DATA_DIR_DEFAULT
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
114 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
115
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
116 # Delete compiled templates in case they are out of date
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
117 if [[ ! -z $GALAXY_CONFIG_TEMPLATE_CACHE_PATH ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
118 rm -rf $GALAXY_CONFIG_TEMPLATE_CACHE_PATH/*
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
119 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
120
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
121 # Enable loading of dependencies on startup. Such as LDAP.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
122 # Adapted from galaxyproject/galaxy/scripts/common_startup.sh
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
123 if [[ ! -z $LOAD_GALAXY_CONDITIONAL_DEPENDENCIES ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
124 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
125 echo "Installing optional dependencies in galaxy virtual environment..."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
126 : ${GALAXY_WHEELS_INDEX_URL:="https://wheels.galaxyproject.org/simple"}
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
127 GALAXY_CONDITIONAL_DEPENDENCIES=$(PYTHONPATH=lib python -c "import galaxy.dependencies; print('\n'.join(galaxy.dependencies.optional('$GALAXY_CONFIG_FILE')))")
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
128 [ -z "$GALAXY_CONDITIONAL_DEPENDENCIES" ] || echo "$GALAXY_CONDITIONAL_DEPENDENCIES" | pip install -q -r /dev/stdin --index-url "${GALAXY_WHEELS_INDEX_URL}"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
129 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
130
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
131 if [[ ! -z $LOAD_GALAXY_CONDITIONAL_DEPENDENCIES ]] && [[ ! -z $LOAD_PYTHON_DEV_DEPENDENCIES ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
132 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
133 echo "Installing development requirements in galaxy virtual environment..."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
134 : ${GALAXY_WHEELS_INDEX_URL:="https://wheels.galaxyproject.org/simple"}
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
135 dev_requirements='./lib/galaxy/dependencies/dev-requirements.txt'
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
136 [ -f $dev_requirements ] && pip install -q -r $dev_requirements --index-url "${GALAXY_WHEELS_INDEX_URL}"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
137 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
138
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
139 # Enable Test Tool Shed
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
140 if [[ ! -z $ENABLE_TTS_INSTALL ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
141 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
142 echo "Enable installation from the Test Tool Shed."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
143 export GALAXY_CONFIG_TOOL_SHEDS_CONFIG_FILE=$GALAXY_HOME/tool_sheds_conf.xml
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
144 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
145
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
146 # Remove all default tools from Galaxy by default
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
147 if [[ ! -z $BARE ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
148 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
149 echo "Remove all tools from the tool_conf.xml file."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
150 export GALAXY_CONFIG_TOOL_CONFIG_FILE=config/shed_tool_conf.xml,$GALAXY_ROOT/test/functional/tools/upload_tool_conf.xml
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
151 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
152
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
153 # If auto installing conda envs, make sure bcftools is installed for __set_metadata__ tool
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
154 if [[ ! -z $GALAXY_CONFIG_CONDA_AUTO_INSTALL ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
155 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
156 if [ ! -d "/tool_deps/_conda/envs/__bcftools@1.5" ]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
157 su $GALAXY_USER -c "/tool_deps/_conda/bin/conda create -y --override-channels --channel iuc --channel conda-forge --channel bioconda --channel defaults --name __bcftools@1.5 bcftools=1.5"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
158 su $GALAXY_USER -c "/tool_deps/_conda/bin/conda clean --tarballs --yes"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
159 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
160 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
161
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
162 if [[ ! -z $GALAXY_EXTRAS_CONFIG_POSTGRES ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
163 if [[ $NONUSE != *"postgres"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
164 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
165 # Backward compatibility for exported postgresql directories before version 15.08.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
166 # In previous versions postgres has the UID/GID of 102/106. We changed this in
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
167 # https://github.com/bgruening/docker-galaxy-stable/pull/71 to GALAXY_POSTGRES_UID=1550 and
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
168 # GALAXY_POSTGRES_GID=1550
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
169 if [ -e /export/postgresql/ ];
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
170 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
171 if [ `stat -c %g /export/postgresql/` == "106" ];
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
172 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
173 chown -R postgres:postgres /export/postgresql/
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
174 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
175 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
176 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
177 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
178
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
179
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
180 if [[ ! -z $GALAXY_EXTRAS_CONFIG_CONDOR ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
181 if [[ ! -z $ENABLE_CONDOR ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
182 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
183 if [[ ! -z $CONDOR_HOST ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
184 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
185 echo "Enabling Condor with external scheduler at $CONDOR_HOST"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
186 echo "# Config generated by startup.sh
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
187 CONDOR_HOST = $CONDOR_HOST
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
188 ALLOW_ADMINISTRATOR = *
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
189 ALLOW_OWNER = *
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
190 ALLOW_READ = *
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
191 ALLOW_WRITE = *
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
192 ALLOW_CLIENT = *
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
193 ALLOW_NEGOTIATOR = *
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
194 DAEMON_LIST = MASTER, SCHEDD
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
195 UID_DOMAIN = galaxy
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
196 DISCARD_SESSION_KEYRING_ON_STARTUP = False
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
197 TRUST_UID_DOMAIN = true" > /etc/condor/condor_config.local
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
198 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
199
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
200 if [[ -e /export/condor_config ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
201 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
202 echo "Replacing Condor config by locally supplied config from /export/condor_config"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
203 rm -f /etc/condor/condor_config
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
204 ln -s /export/condor_config /etc/condor/condor_config
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
205 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
206 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
207 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
208
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
209
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
210 # Copy or link the slurm/munge config files
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
211 if [ -e /export/slurm.conf ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
212 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
213 rm -f /etc/slurm-llnl/slurm.conf
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
214 ln -s /export/slurm.conf /etc/slurm-llnl/slurm.conf
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
215 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
216 # Configure SLURM with runtime hostname.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
217 # Use absolute path to python so virtualenv is not used.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
218 /usr/bin/python /usr/sbin/configure_slurm.py
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
219 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
220 if [ -e /export/munge.key ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
221 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
222 rm -f /etc/munge/munge.key
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
223 ln -s /export/munge.key /etc/munge/munge.key
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
224 chmod 400 /export/munge.key
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
225 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
226
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
227 # link the gridengine config file
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
228 if [ -e /export/act_qmaster ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
229 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
230 rm -f /var/lib/gridengine/default/common/act_qmaster
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
231 ln -s /export/act_qmaster /var/lib/gridengine/default/common/act_qmaster
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
232 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
233
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
234 # Waits until postgres is ready
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
235 function wait_for_postgres {
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
236 echo "Checking if database is up and running"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
237 until /usr/local/bin/check_database.py 2>&1 >/dev/null; do sleep 1; echo "Waiting for database"; done
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
238 echo "Database connected"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
239 }
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
240
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
241 # $NONUSE can be set to include cron, proftp, reports or nodejs
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
242 # if included we will _not_ start these services.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
243 function start_supervisor {
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
244 supervisord -c /etc/supervisor/supervisord.conf
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
245 sleep 5
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
246
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
247 if [[ ! -z $SUPERVISOR_MANAGE_POSTGRES && ! -z $SUPERVISOR_POSTGRES_AUTOSTART ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
248 if [[ $NONUSE != *"postgres"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
249 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
250 echo "Starting postgres"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
251 supervisorctl start postgresql
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
252 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
253 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
254
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
255 wait_for_postgres
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
256
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
257 # Make sure the database is automatically updated
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
258 if [[ ! -z $GALAXY_AUTO_UPDATE_DB ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
259 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
260 echo "Updating Galaxy database"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
261 sh manage_db.sh -c /etc/galaxy/galaxy.yml upgrade
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
262 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
263
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
264 if [[ ! -z $SUPERVISOR_MANAGE_CRON ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
265 if [[ $NONUSE != *"cron"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
266 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
267 echo "Starting cron"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
268 supervisorctl start cron
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
269 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
270 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
271
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
272 if [[ ! -z $SUPERVISOR_MANAGE_PROFTP ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
273 if [[ $NONUSE != *"proftp"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
274 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
275 echo "Starting ProFTP"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
276 supervisorctl start proftpd
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
277 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
278 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
279
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
280 if [[ ! -z $SUPERVISOR_MANAGE_REPORTS ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
281 if [[ $NONUSE != *"reports"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
282 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
283 echo "Starting Galaxy reports webapp"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
284 supervisorctl start reports
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
285 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
286 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
287
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
288 if [[ ! -z $SUPERVISOR_MANAGE_IE_PROXY ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
289 if [[ $NONUSE != *"nodejs"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
290 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
291 echo "Starting nodejs"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
292 supervisorctl start galaxy:galaxy_nodejs_proxy
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
293 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
294 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
295
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
296 if [[ ! -z $SUPERVISOR_MANAGE_CONDOR ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
297 if [[ $NONUSE != *"condor"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
298 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
299 echo "Starting condor"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
300 supervisorctl start condor
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
301 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
302 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
303
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
304 if [[ ! -z $SUPERVISOR_MANAGE_SLURM ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
305 if [[ $NONUSE != *"slurmctld"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
306 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
307 echo "Starting slurmctld"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
308 supervisorctl start slurmctld
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
309 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
310 if [[ $NONUSE != *"slurmd"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
311 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
312 echo "Starting slurmd"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
313 supervisorctl start slurmd
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
314 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
315 supervisorctl start munge
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
316 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
317 if [[ $NONUSE != *"slurmctld"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
318 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
319 echo "Starting slurmctld"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
320 /usr/sbin/slurmctld -L $GALAXY_LOGS_DIR/slurmctld.log
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
321 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
322 if [[ $NONUSE != *"slurmd"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
323 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
324 echo "Starting slurmd"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
325 /usr/sbin/slurmd -L $GALAXY_LOGS_DIR/slurmd.log
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
326 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
327
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
328 # We need to run munged regardless
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
329 mkdir -p /var/run/munge && /usr/sbin/munged -f
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
330 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
331 }
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
332
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
333 if [[ ! -z $SUPERVISOR_POSTGRES_AUTOSTART ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
334 if [[ $NONUSE != *"postgres"* ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
335 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
336 # Change the data_directory of postgresql in the main config file
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
337 ansible localhost -m lineinfile -a "line='data_directory = \'$PG_DATA_DIR_HOST\'' dest=$PG_CONF_DIR_DEFAULT/postgresql.conf backup=yes state=present regexp='data_directory'" &> /dev/null
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
338 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
339 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
340
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
341 if $PRIVILEGED; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
342 echo "Enable Galaxy Interactive Environments."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
343 export GALAXY_CONFIG_INTERACTIVE_ENVIRONMENT_PLUGINS_DIRECTORY="config/plugins/interactive_environments"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
344 if [ x$DOCKER_PARENT == "x" ]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
345 #build the docker in docker environment
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
346 bash /root/cgroupfs_mount.sh
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
347 start_supervisor
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
348 supervisorctl start docker
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
349 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
350 #inheriting /var/run/docker.sock from parent, assume that you need to
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
351 #run docker with sudo to validate
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
352 echo "$GALAXY_USER ALL = NOPASSWD : ALL" >> /etc/sudoers
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
353 start_supervisor
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
354 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
355 if [[ ! -z $PULL_IE_IMAGES ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
356 echo "About to pull IE images. Depending on the size, this may take a while!"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
357
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
358 for ie in {JUPYTER,RSTUDIO,ETHERCALC,PHINCH,NEO}; do
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
359 enabled_var_name="GALAXY_EXTRAS_IE_FETCH_${ie}";
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
360 if [[ ${!enabled_var_name} ]]; then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
361 # Store name in a var
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
362 image_var_name="GALAXY_EXTRAS_${ie}_IMAGE"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
363 # And then read from that var
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
364 docker pull "${!image_var_name}"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
365 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
366 done
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
367 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
368
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
369 # in privileged mode autofs and CVMFS is available
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
370 # install autofs
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
371 echo "Installing autofs to enable automatic CVMFS mounts"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
372 apt-get install autofs --no-install-recommends -y
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
373 apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
374 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
375 echo "Disable Galaxy Interactive Environments. Start with --privileged to enable IE's."
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
376 export GALAXY_CONFIG_INTERACTIVE_ENVIRONMENT_PLUGINS_DIRECTORY=""
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
377 start_supervisor
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
378 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
379
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
380 if [ "$USE_HTTPS_LETSENCRYPT" != "False" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
381 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
382 echo "Settting up letsencrypt"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
383 ansible-playbook -c local /ansible/provision.yml \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
384 --extra-vars gather_facts=False \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
385 --extra-vars galaxy_extras_config_ssl=True \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
386 --extra-vars galaxy_extras_config_ssl_method=letsencrypt \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
387 --extra-vars galaxy_extras_galaxy_domain="GALAXY_CONFIG_GALAXY_INFRASTRUCTURE_URL" \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
388 --extra-vars galaxy_extras_config_nginx_upload=False \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
389 --tags https
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
390 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
391 if [ "$USE_HTTPS" != "False" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
392 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
393 if [ -f /export/server.key -a -f /export/server.crt ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
394 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
395 echo "Copying SSL keys"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
396 ansible-playbook -c local /ansible/provision.yml \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
397 --extra-vars gather_facts=False \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
398 --extra-vars galaxy_extras_config_ssl=True \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
399 --extra-vars galaxy_extras_config_ssl_method=own \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
400 --extra-vars src_nginx_ssl_certificate_key=/export/server.key \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
401 --extra-vars src_nginx_ssl_certificate=/export/server.crt \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
402 --extra-vars galaxy_extras_config_nginx_upload=False \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
403 --tags https
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
404 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
405 echo "Setting up self-signed SSL keys"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
406 ansible-playbook -c local /ansible/provision.yml \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
407 --extra-vars gather_facts=False \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
408 --extra-vars galaxy_extras_config_ssl=True \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
409 --extra-vars galaxy_extras_config_ssl_method=self-signed \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
410 --extra-vars galaxy_extras_config_nginx_upload=False \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
411 --tags https
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
412 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
413 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
414
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
415 # In case the user wants the default admin to be created, do so.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
416 if [[ ! -z $GALAXY_DEFAULT_ADMIN_USER ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
417 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
418 echo "Creating admin user $GALAXY_DEFAULT_ADMIN_USER with key $GALAXY_DEFAULT_ADMIN_KEY and password $GALAXY_DEFAULT_ADMIN_PASSWORD if not existing"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
419 python /usr/local/bin/create_galaxy_user.py --user "$GALAXY_DEFAULT_ADMIN_EMAIL" --password "$GALAXY_DEFAULT_ADMIN_PASSWORD" \
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
420 -c "$GALAXY_CONFIG_FILE" --username "$GALAXY_DEFAULT_ADMIN_USER" --key "$GALAXY_DEFAULT_ADMIN_KEY"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
421 # If there is a need to execute actions that would require a live galaxy instance, such as adding workflows, setting quotas, adding more users, etc.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
422 # then place a file with that logic named post-start-actions.sh on the /export/ directory, it should have access to all environment variables
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
423 # visible here.
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
424 # The file needs to be executable (chmod a+x post-start-actions.sh)
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
425 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
426 if [ -x /export/post-start-actions.sh ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
427 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
428 # uses ephemeris, present in docker-galaxy-stable, to wait for the local instance
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
429 /tool_deps/_conda/bin/galaxy-wait -g http://127.0.0.1 -v --timeout 120 > $GALAXY_LOGS_DIR/post-start-actions.log &&
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
430 /export/post-start-actions.sh >> $GALAXY_LOGS_DIR/post-start-actions.log &
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
431 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
432
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
433
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
434 # Reinstall tools if the user want to
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
435 if [[ ! -z $GALAXY_AUTO_UPDATE_TOOLS ]]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
436 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
437 /tool_deps/_conda/bin/galaxy-wait -g http://127.0.0.1 -v --timeout 120 > /home/galaxy/logs/post-start-actions.log &&
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
438 OLDIFS=$IFS
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
439 IFS=','
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
440 for TOOL_YML in `echo "$GALAXY_AUTO_UPDATE_TOOLS"`
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
441 do
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
442 echo "Installing tools from $TOOL_YML"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
443 /tool_deps/_conda/bin/shed-tools install -g "http://127.0.0.1" -a "$GALAXY_DEFAULT_ADMIN_KEY" -t "$TOOL_YML"
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
444 /tool_deps/_conda/bin/conda clean --tarballs --yes
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
445 done
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
446 IFS=$OLDIFS
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
447 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
448
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
449 # migrate custom IEs or Visualisations (Galaxy plugins)
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
450 # this is needed for by the new client build system
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
451 python3 ${GALAXY_ROOT}/scripts/plugin_staging.py
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
452
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
453 # Enable verbose output
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
454 if [ `echo ${GALAXY_LOGGING:-'no'} | tr [:upper:] [:lower:]` = "full" ]
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
455 then
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
456 tail -f /var/log/supervisor/* /var/log/nginx/* $GALAXY_LOGS_DIR/*.log
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
457 else
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
458 tail -f $GALAXY_LOGS_DIR/*.log
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
459 fi
f8c1694190f0 Uploaded
fubar
parents:
diff changeset
460