1 # Arvados API server Docker container.
4 MAINTAINER Tim Pierce <twp@curoverse.com>
6 # Install postgres and apache.
8 RUN apt-get install -qqy \
9 procps postgresql postgresql-server-dev-9.1 apache2 slurm-llnl munge \
10 supervisor sudo libwww-perl libio-socket-ssl-perl libcrypt-ssleay-perl \
11 libjson-perl cron openssh-server
13 ADD munge.key /etc/munge/
14 RUN chown munge:munge /etc/munge/munge.key && chmod 600 /etc/munge/munge.key
15 ADD generated/slurm.conf /etc/slurm-llnl/
17 RUN /usr/local/rvm/bin/rvm-exec default gem install arvados-cli arvados
18 # /for crunch-dispatch
20 RUN /bin/mkdir -p /usr/src/arvados/services
21 ADD generated/api.tar.gz /usr/src/arvados/services/
23 # Install generated config files
24 ADD generated/database.yml /usr/src/arvados/services/api/config/database.yml
25 ADD generated/omniauth.rb /usr/src/arvados/services/api/config/initializers/omniauth.rb
26 RUN /bin/cp /usr/src/arvados/services/api/config/environments/production.rb.example /usr/src/arvados/services/api/config/environments/production.rb
27 ADD generated/application.yml /usr/src/arvados/services/api/config/application.yml
28 ADD generated/apache2_vhost /etc/apache2/sites-available/arvados
30 # Configure Rails databases.
31 ENV RAILS_ENV production
32 ADD generated/config_databases.sh /tmp/config_databases.sh
33 ADD generated/superuser_token /tmp/superuser_token
34 RUN /usr/local/rvm/bin/rvm-exec default bundle install --gemfile=/usr/src/arvados/services/api/Gemfile && \
35 sh /tmp/config_databases.sh && \
36 rm /tmp/config_databases.sh && \
37 /etc/init.d/postgresql start && \
38 cd /usr/src/arvados/services/api && \
39 /usr/local/rvm/bin/rvm-exec default bundle exec rake db:structure:load && \
40 /usr/local/rvm/bin/rvm-exec default bundle exec rake db:seed && \
41 /usr/local/rvm/bin/rvm-exec default bundle exec rake assets:precompile && \
42 /usr/local/rvm/bin/rvm-exec default ./script/create_superuser_token.rb $(cat /tmp/superuser_token) && \
43 chown www-data:www-data config.ru && \
44 chown www-data:www-data log -R && \
46 chown www-data:www-data tmp -R
48 # Configure Apache and Passenger.
49 RUN a2dissite default && \
53 /bin/mkdir /var/run/apache2
55 # Install a token for root
56 RUN mkdir -p /root/.config/arvados; echo "ARVADOS_API_HOST=api" >> /root/.config/arvados/settings.conf && echo "ARVADOS_API_HOST_INSECURE=yes" >> /root/.config/arvados/settings.conf && echo "ARVADOS_API_TOKEN=$(cat /tmp/superuser_token)" >> /root/.config/arvados/settings.conf && chmod 600 /root/.config/arvados/settings.conf
58 # Set up directory for job commit repo
59 RUN mkdir -p /var/lib/arvados
61 RUN addgroup --gid 4005 crunch && mkdir /home/crunch && useradd --uid 4005 --gid 4005 crunch && chown crunch:crunch /home/crunch
63 # Create keep and compute node objects
64 ADD keep_server_0.json /root/
65 ADD keep_server_1.json /root/
66 ADD keep_proxy.json /root/
68 # Set up update-gitolite.rb
69 RUN mkdir /usr/local/arvados/config -p
70 ADD generated/arvados-clients.yml /usr/local/arvados/config/
71 ADD update-gitolite.rb /usr/local/arvados/
74 ADD supervisor.conf /etc/supervisor/conf.d/arvados.conf
75 ADD generated/setup.sh /usr/local/bin/setup.sh
76 ADD generated/setup-gitolite.sh /usr/local/bin/setup-gitolite.sh
77 ADD crunch-dispatch-run.sh /usr/local/bin/crunch-dispatch-run.sh
78 ADD apache2_foreground.sh /etc/apache2/foreground.sh
80 # Start the supervisor.
81 CMD ["/usr/bin/supervisord", "-n"]