Merge branch 'improve_postinstall_script' into 'master'
Improve postinstall script Improvements proposed here will: 1. Check if the instance is EC2 and if yes query for public hostname 1. If gitlab.rb already exists, read the external url set there and print that in the postinst message Postinst message also got updated a bit to make commands easier to copy and separate from comments: ``` gitlab: Thank you for installing GitLab! gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND: sudo gitlab-ctl reconfigure gitlab: GitLab should be reachable at http://ec2-54-157-26-185.compute-1.amazonaws.com gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file gitlab: And running reconfigure again. gitlab: gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab: gitlab: gitlab: If you just upgraded from GitLab 7.9 or earlier, please run the following gitlab: command: sudo ln -sf /opt/gitlab/bin/gitlab-ctl /opt/gitlab/bin/gitlab-rake /opt/gitlab/bin/gitlab-rails /opt/gitlab/bin/gitlab-ci-rake /opt/gitlab/bin/gitlab-ci-rails /usr/bin/ gitlab: ``` Fixes #520 Fixes #521 See merge request !398
This commit is contained in:
commit
dba7d1ed2a
|
@ -6,6 +6,7 @@
|
|||
|
||||
PROGNAME=$(basename $0)
|
||||
DEST_DIR=<%= install_dir %>
|
||||
EXTERNAL_URL="http://gitlab.example.com"
|
||||
usr_bin_symlinks="\
|
||||
${DEST_DIR}/bin/gitlab-ctl \
|
||||
${DEST_DIR}/bin/gitlab-rake \
|
||||
|
@ -15,14 +16,6 @@ usr_bin_symlinks="\
|
|||
"
|
||||
symlink_command="ln -sf ${usr_bin_symlinks} /usr/bin/"
|
||||
|
||||
# Try collecting fqdn if it is set correctly
|
||||
fqdn=$(/bin/hostname -f)
|
||||
if [ -n "${fqdn}" ]; then
|
||||
external_url="http://${fqdn}"
|
||||
else
|
||||
external_url="http://gitlab.example.com"
|
||||
fi
|
||||
|
||||
error_exit()
|
||||
{
|
||||
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
|
||||
|
@ -45,8 +38,10 @@ create_config_template()
|
|||
if ! [ -e /etc/gitlab/gitlab.rb ] ; then
|
||||
mkdir -p /etc/gitlab
|
||||
cp "${DEST_DIR}/etc/gitlab.rb.template" /etc/gitlab/gitlab.rb
|
||||
sed -i 's!GENERATED_EXTERNAL_URL!'$external_url'!g' /etc/gitlab/gitlab.rb
|
||||
sed -i 's!GENERATED_EXTERNAL_URL!'$EXTERNAL_URL'!g' /etc/gitlab/gitlab.rb
|
||||
chmod 600 /etc/gitlab/gitlab.rb
|
||||
else
|
||||
EXTERNAL_URL=$(awk '/^external_url/ { print $2 }' /etc/gitlab/gitlab.rb | tr -d "'\"")
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -68,11 +63,11 @@ fi
|
|||
print_welcome()
|
||||
{
|
||||
notify "Thank you for installing GitLab!"
|
||||
notify "Configure and start GitLab by running the following command:"
|
||||
notify
|
||||
notify "sudo gitlab-ctl reconfigure"
|
||||
notify
|
||||
notify "GitLab should be reachable at ${external_url}"
|
||||
notify "To configure and start GitLab, RUN THE FOLLOWING COMMAND:"
|
||||
echo ""
|
||||
echo "sudo gitlab-ctl reconfigure"
|
||||
echo ""
|
||||
notify "GitLab should be reachable at ${EXTERNAL_URL}"
|
||||
notify "Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file"
|
||||
notify "And running reconfigure again."
|
||||
notify
|
||||
|
@ -81,10 +76,44 @@ print_welcome()
|
|||
notify
|
||||
}
|
||||
|
||||
check_if_ec2()
|
||||
{
|
||||
if [ -f /sys/hypervisor/uuid ] && [ `head -c 3 /sys/hypervisor/uuid` == ec2 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_fqdn_from_hostname()
|
||||
{
|
||||
# Try collecting fqdn if it is set correctly
|
||||
fqdn=$(/bin/hostname -f)
|
||||
if [ -n "${fqdn}" ]; then
|
||||
EXTERNAL_URL="http://${fqdn}"
|
||||
fi
|
||||
}
|
||||
|
||||
get_ec2_hostname()
|
||||
{
|
||||
# Try collecting fqdn if it is set correctly
|
||||
fqdn=$(/opt/gitlab/embedded/bin/curl -s http://169.254.169.254/latest/meta-data/public-hostname)
|
||||
if [ -n "${fqdn}" ]; then
|
||||
EXTERNAL_URL="http://${fqdn}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "${GITLAB_DEBUG}" ] ; then
|
||||
notify "debug: arguments: $@"
|
||||
fi
|
||||
|
||||
check_if_ec2
|
||||
if [ $? -eq 0 ] ; then
|
||||
get_ec2_hostname
|
||||
else
|
||||
get_fqdn_from_hostname
|
||||
fi
|
||||
|
||||
create_symlinks
|
||||
create_config_template
|
||||
fix_directory_permissions
|
||||
|
@ -108,8 +137,10 @@ case "$1" in
|
|||
notify
|
||||
notify "If you just upgraded from GitLab 7.9 or earlier, please run the following"
|
||||
notify "command:"
|
||||
notify
|
||||
echo ""
|
||||
notify "sudo ${symlink_command}"
|
||||
echo ""
|
||||
notify ""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue