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 #!/bin/bash
USER="$1" 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 if [ -d $HDIR ] ; then
#echo "user dir exist" #echo "user dir exist"
exit 0 exit 0
else else
if id -u $USER >/dev/null 2>&1 if id -u $USER >/dev/null 2>&1
then then
#"echo "ldap user first login" #"echo "ldap user first login"
/bin/su - $USER sudo /bin/su - $USER /bin/ls
exit 0 sudo /bin/chmod g+ws $HDIR
else sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }}
#echo "user does not exist and is not ldap" sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }}
/usr/sbin/useradd -m -s /bin/false $USER sudo /bin/chgrp -R {{ smartgears_user }} $HDIR
fi 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 fi

View File

@ -8,10 +8,14 @@ server {
proxy_read_timeout 600; proxy_read_timeout 600;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 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_set_header Host $http_host;
proxy_redirect off; 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 instance in tomcat_m_instances %}
{% for context in instance.app_contexts %} {% for context in instance.app_contexts %}
location /{{ context }} { location /{{ context }} {