library/roles/smartgears/r_connector: Fix the script that initializes/creates uses.

library/roles/smartgears/smartgears-nginx-frontend/templates/rstudio-dev.d4science.org-virtualhost.j2: Add a piece of configuration that was only on the production server.
This commit is contained in:
Andrea Dell'Amico 2016-07-21 19:29:32 +02:00
parent 31c6288e85
commit 76237a9b6b
2 changed files with 28 additions and 13 deletions

View File

@ -1,19 +1,30 @@
#!/bin/bash
USER="$1"
HDIR="{{ r_connector_usershome }}/$USER"
HDIR="{{ r_connector_usershome }}$USER"
logfile={{ smartgears_user_home }}/tomcat/logs/runuseradd.log
exec > $logfile 2>&1
if [ -d $HDIR ] ; then
#echo "user dir exist"
exit 0
#echo "user dir exist"
exit 0
else
if id -u $USER >/dev/null 2>&1
then
#"echo "ldap user first login"
/bin/su - $USER
exit 0
else
#echo "user does not exist and is not ldap"
/usr/sbin/useradd -m -s /bin/false $USER
fi
if id -u $USER >/dev/null 2>&1
then
#"echo "ldap user first login"
sudo /bin/su - $USER /bin/ls
sudo /bin/chmod g+ws $HDIR
sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
exit 0
else
#echo "user does not exist and is not ldap"
sudo /usr/sbin/useradd -m -s /bin/false -g {{ smartgears_user }} $USER
sudo /bin/chmod g+ws $HDIR
sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
fi
fi

View File

@ -8,10 +8,14 @@ server {
proxy_read_timeout 600;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $schema;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header Host $http_host;
proxy_redirect off;
location /auth-sign-in {
rewrite ^/auth-sign-in http://{{ ansible_fqdn }}/r-connector/gcube/service/disconnect;
}
{% for instance in tomcat_m_instances %}
{% for context in instance.app_contexts %}
location /{{ context }} {