diff --git a/Dockerfile b/Dockerfile index 44bd9780..ec373e69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,4 +33,5 @@ RUN chmod 700 /root/.ssh && chmod 600 /root/.ssh/authorized_keys && chown root:r EXPOSE 22 EXPOSE 80 -CMD ["/gitlab/gitlab"] +ENTRYPOINT ["/gitlab/gitlab"] +CMD ["start"] diff --git a/resources/gitlab b/resources/gitlab index af7809ed..8d3dd9cc 100755 --- a/resources/gitlab +++ b/resources/gitlab @@ -125,21 +125,41 @@ chown -R git:git /home/git/.ssh cd /home/git/gitlab/ -# reset the database if the --db-init switch was given. -if [ "$DB_INIT" == "yes" ]; then - sudo -u git -H force=yes bundle exec rake gitlab:setup RAILS_ENV=production -fi +gitlab_start () { + echo "Starting gitlab server..." + # reset the database if the --db-init switch was given. + if [ "$DB_INIT" == "yes" ]; then + sudo -u git -H force=yes bundle exec rake gitlab:setup RAILS_ENV=production + fi -# start the gitlab application -# sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production -/etc/init.d/gitlab start + # start the gitlab application + # sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + /etc/init.d/gitlab start -# create satellite directories -sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production -sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + # create satellite directories + sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production -# kickstart the rails application -wget "http://localhost" -O /dev/null + # kickstart the rails application + wget "http://localhost" -O /dev/null -# watch the access logs -tail -F /var/log/nginx/gitlab_access.log + # watch the access logs + tail -F /var/log/nginx/gitlab_access.log +} + +gitlab_help () { + echo "Available options:" + echo " start - Starts the gitlab server (default)" + echo " help - Displays the help" +} + +case "$1" in + start) + gitlab_start + ;; + help|*) + gitlab_help + ;; +esac + +exit 0