annotate docker/startup @ 42:b938475235e3 draft

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