Merge branch 'feature/fix-usage-with-non-standard-ports', fixes #53, #34

This commit is contained in:
Sameer Naik 2014-04-26 17:37:28 +05:30
commit cd21d296b6
3 changed files with 26 additions and 5 deletions

View File

@ -1,6 +1,7 @@
# Changelog
**latest**
- fix git over ssh when the default http/https ports are not used.
- compile the assets only if it does not exist or if the gitlab version has changed.
- upgrade gitlab-shell to version 1.9.4
- cache compiled assets to boost application startup.

View File

@ -2,7 +2,7 @@
user: git
# Url to gitlab instance. Used for api calls. Should end with a slash.
gitlab_url: "http://{{GITLAB_HOST}}/"
gitlab_url: "{{GITLAB_URL}}"
http_settings:
# user: someone

View File

@ -2,7 +2,7 @@
set -e
GITLAB_HOST=${GITLAB_HOST:-localhost}
GITLAB_PORT=${GITLAB_PORT:-80}
GITLAB_PORT=${GITLAB_PORT:-}
GITLAB_HTTPS=${GITLAB_HTTPS:-false}
GITLAB_EMAIL=${GITLAB_EMAIL:-gitlab@localhost}
GITLAB_SUPPORT=${GITLAB_SUPPORT:-support@localhost}
@ -84,6 +84,17 @@ case "${DB_TYPE}" in
*) echo "Unsupported database adapter. Available adapters are mysql and postgres." && exit 1 ;;
esac
case "${GITLAB_HTTPS}" in
true)
GITLAB_URL="https://${GITLAB_HOST}${GITLAB_PORT:+:$GITLAB_PORT}/"
GITLAB_PORT=${GITLAB_PORT:-443}
;;
*)
GITLAB_URL="http://${GITLAB_HOST}${GITLAB_PORT:+:$GITLAB_PORT}/"
GITLAB_PORT=${GITLAB_PORT:-80}
;;
esac
case "${GITLAB_BACKUPS}" in
daily|monthly) GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-604800} ;;
disable|*) GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-0} ;;
@ -223,10 +234,16 @@ sudo -u git -H sed 's/{{REDIS_HOST}}/'"${REDIS_HOST}"'/' -i /home/git/gitlab/con
sudo -u git -H sed 's/{{REDIS_PORT}}/'"${REDIS_PORT}"'/' -i /home/git/gitlab/config/resque.yml
# configure gitlab-shell
sudo -u git -H sed 's/{{GITLAB_HOST}}/'"${GITLAB_HOST}:${GITLAB_PORT}"'/' -i /home/git/gitlab-shell/config.yml
sudo -u git -H sed 's,{{GITLAB_URL}},'"${GITLAB_URL}"',' -i /home/git/gitlab-shell/config.yml
sudo -u git -H sed 's/{{REDIS_HOST}}/'"${REDIS_HOST}"'/' -i /home/git/gitlab-shell/config.yml
sudo -u git -H sed 's/{{REDIS_PORT}}/'"${REDIS_PORT}"'/' -i /home/git/gitlab-shell/config.yml
# hack: make git over ssh work when the default http/https ports are not used.
case "${GITLAB_HTTPS}" in
true) sed -i 's,#{config.gitlab_url}/api/v3/internal,https://localhost/api/v3/internal,' -i /home/git/gitlab-shell/lib/gitlab_net.rb ;;
*) sed -i 's,#{config.gitlab_url}/api/v3/internal,http://localhost/api/v3/internal,' -i /home/git/gitlab-shell/lib/gitlab_net.rb ;;
esac
# configure unicorn workers
sed 's/{{UNICORN_WORKERS}}/'"${UNICORN_WORKERS}"'/' -i /home/git/gitlab/config/unicorn.rb
@ -346,8 +363,11 @@ EOF
crontab -u git /tmp/cron.git && rm -rf /tmp/cron.git
# kickstart the rails application
wget "http://localhost" -O /dev/null
if [ "${GITLAB_HTTPS}" == "true" ]; then
wget --no-check-certificate "https://${GITLAB_HOST}" -O /dev/null
else
wget "http://${GITLAB_HOST}" -O /dev/null
fi
# watch the access logs
tail -F /var/log/nginx/gitlab_access.log