Commit 20f29eb8 authored by root's avatar root
parents c22082a5 b89cc910
FROM ubuntu:16.04 FROM ubuntu:16.04
MAINTAINER Sebastien.Carrere@toulouse.inra.fr MAINTAINER sebastien.carrere@inra.fr
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get -q update && \ RUN apt-get -q update && \
...@@ -21,19 +21,14 @@ WORKDIR $ROOTDIR ...@@ -21,19 +21,14 @@ WORKDIR $ROOTDIR
RUN chown -R www-data.www-data $ROOTDIR RUN chown -R www-data.www-data $ROOTDIR
RUN a2enmod rewrite RUN a2enmod rewrite && \
RUN a2enmod cgi a2enmod cgi && \
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
cp $ROOTDIR/site/cfg/site-docker.cfg $ROOTDIR/site/cfg/site.cfg && \
cp $ROOTDIR/site/cfg/authentication-docker.cfg $ROOTDIR/site/cfg/authentication.cfg && \
RUN cp $ROOTDIR/site/cfg/site-docker.cfg $ROOTDIR/site/cfg/site.cfg export USER=root && ./bin/int/admin_install.pl --docker && \
RUN cp $ROOTDIR/site/cfg/authentication-docker.cfg $ROOTDIR/site/cfg/authentication.cfg cp $ROOTDIR/site/cfg/apache-docker.conf /etc/apache2/sites-available/000-default.conf
RUN export USER=root && ./bin/int/admin_install.pl --docker
RUN cp $ROOTDIR/site/cfg/apache-docker.conf /etc/apache2/sites-available/000-default.conf
WORKDIR $ROOTDIR/site WORKDIR $ROOTDIR/site
CMD ["sh","-c","service apache2 start && /bin/bash && export USER=root"] CMD ["sh","-c","service apache2 start && /bin/bash && export USER=root"]
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<li><a href="#prerequisites">PREREQUISITES</a></li> <li><a href="#prerequisites">PREREQUISITES</a></li>
<li><a href="#build">BUILD</a></li> <li><a href="#build">BUILD</a></li>
<li><a href="#configure">CONFIGURE</a></li> <li><a href="#hurry-want-to-run-locally-in-single-user-mode-">HURRY ? WANT TO RUN LOCALLY IN SINGLE USER MODE ?</a></li>
<li><a href="#local-configuration">LOCAL CONFIGURATION</a></li>
<li><a href="#standard-configuration">STANDARD CONFIGURATION</a></li>
<li><a href="#create-admin-user">CREATE ADMIN USER</a></li> <li><a href="#create-admin-user">CREATE ADMIN USER</a></li>
<li><a href="#run-app">RUN APP</a></li> <li><a href="#run-app">RUN APP</a></li>
<li><a href="#stop-app">STOP APP</a></li> <li><a href="#stop-app">STOP APP</a></li>
...@@ -76,6 +78,14 @@ OPTIONNAL: ...@@ -76,6 +78,14 @@ OPTIONNAL:
If you want to create users from host server (not from Docker image), you will need Perl and this perl module If you want to create users from host server (not from Docker image), you will need Perl and this perl module
Apache::Htpasswd perl Apache::Htpasswd perl
### HURRY ? WANT TO RUN LOCALLY IN SINGLE USER MODE ? ###
curl -s https://framagit.org/BBRIC/family-companion/raw/master/local.sh | bash
:information_source:
url to access the app: <b>http://localhost:1977/family-companion</b>
login/password to login into app: <b>guest/guest</b>
### BUILD ### ### BUILD ###
...@@ -85,8 +95,16 @@ If you want to create users from host server (not from Docker image), you will n ...@@ -85,8 +95,16 @@ If you want to create users from host server (not from Docker image), you will n
export FC=$PWD export FC=$PWD
$FC/build.sh $FC/build.sh
### LOCAL CONFIGURATION ###
Run Family-Companion locally:
* login/password set to guest/guest
* sendmail deactivated
* persistence directory set to $HOME/.family-companion
### CONFIGURE ### $FC/configure.sh --local
### STANDARD CONFIGURATION ###
#### Persistence directory #### #### Persistence directory ####
...@@ -132,6 +150,10 @@ From the host server (need Apache::Htpasswd module): ...@@ -132,6 +150,10 @@ From the host server (need Apache::Htpasswd module):
### RUN APP ### ### RUN APP ###
:information_source: Run locally (guest/guest, no mail):
$FC/run.sh --local
:information_source: To start Docker image in interactive mode run: :information_source: To start Docker image in interactive mode run:
$FC/run.sh --login $FC/run.sh --login
......
...@@ -78,7 +78,7 @@ MAIN: ...@@ -78,7 +78,7 @@ MAIN:
my $email = lc($o_param->Get('email')); my $email = lc($o_param->Get('email'));
if (!IsEmailValid($email)) if ($email ne 'guest' && !IsEmailValid($email))
{ {
die "[ERROR] - $email is not a valid email address"; die "[ERROR] - $email is not a valid email address";
} }
...@@ -131,8 +131,7 @@ Url: $url ...@@ -131,8 +131,7 @@ Url: $url
END END
$fh_mail->close; $fh_mail->close;
my $ssmtp_conf = "$FindBin::RealBin/../../data/cfg/ssmtp.conf"; my $ssmtp_conf = "$FindBin::RealBin/../../data/cfg/ssmtp.conf";
$ssmtp_conf = $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf' $ssmtp_conf = $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf' if (defined $ENV{'FC_DIR'} && -e $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf');
if (defined $ENV{'FC_DIR'} && -e $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf');
if (-e $ssmtp_conf) if (-e $ssmtp_conf)
{ {
......
...@@ -100,7 +100,7 @@ sub Dependencies ...@@ -100,7 +100,7 @@ sub Dependencies
my @a_cmd = my @a_cmd =
( (
"apt-get -q update && apt-get install -yq cron at libtree-simple-perl libbio-perl-perl ncbi-blast+ sqlite liberror-perl libswitch-perl libxml-simple-perl libjson-perl libapache-session-perl libnet-ldap-perl libapache-htpasswd-perl ssmtp fasttree mafft biosquid python2.7 python-scipy python-sklearn python-numpy python-fastcluster mcl libarray-utils-perl libproc-processtable-perl liburi-encode-perl" "apt-get -q update && apt-get install -yq cron at libtree-simple-perl libbio-perl-perl ncbi-blast+ sqlite liberror-perl libswitch-perl libxml-simple-perl libjson-perl libapache-session-perl libnet-ldap-perl libapache-htpasswd-perl ssmtp fasttree mafft biosquid python2.7 python-scipy python-sklearn python-numpy python-fastcluster mcl libarray-utils-perl libproc-processtable-perl liburi-encode-perl parallel"
); );
my $at_allow_cmd = 'cp /etc/at.deny /etc/at.deny.ori && grep -v "www-data" /etc/at.deny.ori > /etc/at.deny'; my $at_allow_cmd = 'cp /etc/at.deny /etc/at.deny.ori && grep -v "www-data" /etc/at.deny.ori > /etc/at.deny';
......
#!/bin/bash #!/bin/bash
error=0; error=0;
local=0;
echo -e "\e[1m\e[100m"; echo -e "\e[1m\e[100m";
if [[ $1 == *"local"* ]]; then
echo -e "\e[33m>>>> [HELP] - Local installation: login/password set to guest/guest - Sendmail not activated\nData directory set to $HOME/.family-companion\e[39m";
FC_ADMIN='guest'
FC_SMTP='local'
FC_PORT='1977'
FC_HOSTNAME='localhost'
FC_DIR="$HOME/.family-companion"
mkdir -p $FC_DIR
local=1
fi
if [ -z ${FC_DIR+x} ] if [ -z ${FC_DIR+x} ]
then then
...@@ -59,12 +70,12 @@ if [ $error -ne 1 ] ...@@ -59,12 +70,12 @@ if [ $error -ne 1 ]
then then
if [ ! -d $FC_DIR/data ] if [ ! -d $FC_DIR/data ]
then then
mkdir $FC_DIR/data mkdir -p $FC_DIR/data
chown www-data.www-data $FC_DIR/data chown www-data.www-data $FC_DIR/data
fi fi
if [ ! -d $FC_DIR/etc ] if [ ! -d $FC_DIR/etc ]
then then
mkdir $FC_DIR/etc; mkdir -p $FC_DIR/etc;
chown www-data.www-data $FC_DIR/etc chown www-data.www-data $FC_DIR/etc
fi fi
if [ ! -d $FC_DIR/data/cfg ] if [ ! -d $FC_DIR/data/cfg ]
...@@ -118,5 +129,11 @@ cp site/cfg/authentication-docker.cfg site/cfg/authentication.cfg ...@@ -118,5 +129,11 @@ cp site/cfg/authentication-docker.cfg site/cfg/authentication.cfg
cp site/cfg/site-docker.cfg site/cfg/site.cfg cp site/cfg/site-docker.cfg site/cfg/site.cfg
chown www-data.www-data $FC_DIR/data/cfg/local.cfg chown www-data.www-data $FC_DIR/data/cfg/local.cfg
if [ $local -eq 1 ]
then
./bin/int/admin_addUser.pl --email=$FC_ADMIN --password=guest --common_name='guest' --outdir=$FC_DIR/etc
echo -e "mode=local\n" >> $FC_DIR/data/cfg/local.cfg;
fi
echo -e "\e[49m"; echo -e "\e[49m";
echo -e "\e[0m"; echo -e "\e[0m";
...@@ -98,7 +98,7 @@ sub GetOrthologousAlignments ...@@ -98,7 +98,7 @@ sub GetOrthologousAlignments
sub __Align sub __Align
{ {
my $infile = shift; my $infile = shift;
my $cmd = "$MAFFT --globalpair --quiet $infile > $infile.aln"; my $cmd = "$MAFFT --thread $THREADS --globalpair --quiet $infile > $infile.aln";
&System($cmd); &System($cmd);
my %h_alignment = (); my %h_alignment = ();
return; return;
......
...@@ -20,6 +20,7 @@ sub GetAuthentication ...@@ -20,6 +20,7 @@ sub GetAuthentication
{ {
$h_param{'eppn'} = $o_auth->GetEppn(); $h_param{'eppn'} = $o_auth->GetEppn();
} }
$h_param{'email'} = 'guest@guest.fc' if ($O_CONF->Get('mode') eq 'local');
$h_param{'success'} = &TRUE; $h_param{'success'} = &TRUE;
} }
print encode_json(\%h_param); print encode_json(\%h_param);
......
...@@ -28,7 +28,7 @@ sub AdjustConfig ...@@ -28,7 +28,7 @@ sub AdjustConfig
$O_CONF->Update("$rootdir/data/cfg/env.cfg", 'O'); $O_CONF->Update("$rootdir/data/cfg/env.cfg", 'O');
} }
if (!IsEmailValid($O_CONF->Get('admin_mail'))) if ($O_CONF->Get('admin_mail') ne 'guest' && !IsEmailValid($O_CONF->Get('admin_mail')))
{ {
&Die('ERROR - admin_mail is not set - complete site/cfg/site.cfg file ', 'early'); &Die('ERROR - admin_mail is not set - complete site/cfg/site.cfg file ', 'early');
} }
...@@ -137,6 +137,12 @@ sub SendMail ...@@ -137,6 +137,12 @@ sub SendMail
{ {
my ($email, $subject, $body, $cc) = @_; my ($email, $subject, $body, $cc) = @_;
#Mode local, je desactive le sendmail
if ($O_CONF->Get('mode') eq 'local')
{
return 1;
}
my @a_emails = split(',', $email); my @a_emails = split(',', $email);
my @a_valid_emails = (); my @a_valid_emails = ();
foreach my $email_test (@a_emails) foreach my $email_test (@a_emails)
......
#!/bin/bash
sudo bash
git clone https://framagit.org/BBRIC/family-companion.git
cd family-companion
export FC=$PWD
$FC/build.sh
$FC/configure.sh --local
$FC/run.sh --local
...@@ -2,8 +2,25 @@ ...@@ -2,8 +2,25 @@
error=0; error=0;
login=$1; args=$@;
login=0;
local=0;
if [[ "$args" =~ (-login) ]]
then
login=1;
fi
if [[ "$args" =~ (-local) ]]
then
local=1;
FC_ADMIN='guest'
FC_SMTP='local'
FC_PORT='1977'
FC_HOSTNAME='localhost'
FC_DIR="$HOME/.family-companion"
fi
echo -e "\e[1m\e[100m"; echo -e "\e[1m\e[100m";
...@@ -54,7 +71,7 @@ echo -e "portal_port=$FC_PORT\n" >> $FC_DIR/data/cfg/env.cfg; ...@@ -54,7 +71,7 @@ echo -e "portal_port=$FC_PORT\n" >> $FC_DIR/data/cfg/env.cfg;
if [ $error -ne 1 ] if [ $error -ne 1 ]
then then
interactive=' -d '; interactive=' -d ';
if [[ "$login" =~ (-login)$ ]] if [ $login -eq 1 ]
then then
interactive=' -i '; interactive=' -i ';
fi fi
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
SetEnv FC_HOME /var/www/family-companion SetEnv FC_HOME /var/www/family-companion
ScriptAlias "/family-companion/cgi" "/var/www/family-companion/cgi" ScriptAlias "/family-companion/cgi" "/var/www/family-companion/cgi"
RedirectMatch "^/family-companion/*$" "/family-companion/web/" RedirectMatch "^/family-companion/*$" "/family-companion/web/index_prod.html"
RewriteRule ^/family-companion/ws/(\w+)$ /family-companion/cgi/index.cgi?$1=1 [T=application/x-httpd-cgi] RewriteRule ^/family-companion/ws/(\w+)$ /family-companion/cgi/index.cgi?$1=1 [T=application/x-httpd-cgi]
RewriteCond %{QUERY_STRING} ^(.*)$ RewriteCond %{QUERY_STRING} ^(.*)$
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment