1 # Arvados API server Docker container.
4 MAINTAINER Ward Vandewege <ward@curoverse.com>
6 # Install postgres and apache.
8 RUN apt-get install -qy \
9 procps postgresql postgresql-server-dev-9.1 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
29 # Configure Rails databases.
30 ENV RAILS_ENV production
31 ADD generated/config_databases.sh /tmp/config_databases.sh
32 ADD generated/superuser_token /tmp/superuser_token
33 RUN /usr/local/rvm/bin/rvm-exec default bundle install --gemfile=/usr/src/arvados/services/api/Gemfile && \
34 sh /tmp/config_databases.sh && \
35 rm /tmp/config_databases.sh && \
36 /etc/init.d/postgresql start && \
37 cd /usr/src/arvados/services/api && \
38 /usr/local/rvm/bin/rvm-exec default bundle exec rake db:structure:load && \
39 /usr/local/rvm/bin/rvm-exec default bundle exec rake db:seed && \
40 /usr/local/rvm/bin/rvm-exec default bundle exec rake assets:precompile && \
41 /usr/local/rvm/bin/rvm-exec default ./script/create_superuser_token.rb $(cat /tmp/superuser_token) && \
42 chown www-data:www-data config.ru && \
43 chown www-data:www-data log -R && \
45 chown www-data:www-data tmp -R
47 # Install a token for root
48 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
50 # Set up directory for job commit repo
51 RUN mkdir -p /var/lib/arvados
53 RUN addgroup --gid 4005 crunch && mkdir /home/crunch && useradd --uid 4005 --gid 4005 crunch && chown crunch:crunch /home/crunch
55 # Create keep and compute node objects
56 ADD generated/keep_server_0.json /root/
57 ADD generated/keep_server_1.json /root/
58 ADD keep_proxy.json /root/
60 # Set up update-gitolite.rb
61 RUN mkdir /usr/local/arvados/config -p
62 ADD generated/arvados-clients.yml /usr/src/arvados/services/api/config/
63 ADD .gitolite.rc /usr/local/arvados/config/
64 RUN ln /usr/src/arvados/services/api/script/arvados-git-sync.rb /usr/local/bin/
67 ADD supervisor.conf /etc/supervisor/conf.d/arvados.conf
68 ADD generated/setup.sh /usr/local/bin/setup.sh
69 ADD generated/setup-gitolite.sh /usr/local/bin/setup-gitolite.sh
70 ADD crunch-dispatch-run.sh /usr/local/bin/crunch-dispatch-run.sh
71 ADD munge.sh /usr/local/bin/munge.sh
72 ADD passenger.sh /usr/local/bin/passenger.sh
74 # Start the supervisor.
75 CMD ["/usr/bin/supervisord", "-n"]