@@ -17,6 +17,33 @@ function failed_pg_upgrade() {
17
17
exit 1
18
18
}
19
19
20
+ function clean_stale_pids() {
21
+ # cleanup known pid/socket files
22
+ for x in /opt/gitlab/sv /run $( ls -d /tmp/gitaly-ruby* 2> /dev/null) ; do
23
+ # find
24
+ # - any (s)ocket or regular (f)ile
25
+ # - by the name of "*.pid" or "socket.?"
26
+ # - and delete them
27
+ find $x \
28
+ \( \
29
+ -type f \
30
+ -o -type s \
31
+ \) \( \
32
+ -name pid \
33
+ -o -name " *.pid" \
34
+ -o -name " socket.?" \
35
+ \) \
36
+ -delete ;
37
+ done
38
+ }
39
+
40
+ function detect_unclean_start() {
41
+ set +e
42
+ echo " Cleaning stale PIDs & sockets"
43
+ clean_stale_pids
44
+ set -e
45
+ }
46
+
20
47
trap " sigterm_handler; exit" TERM
21
48
22
49
source /RELEASE
@@ -44,6 +71,9 @@ echo " docker restart gitlab"
44
71
echo
45
72
sleep 3s
46
73
74
+ # Run unclean start detection & cleanup
75
+ detect_unclean_start
76
+
47
77
# Copy gitlab.rb for the first time
48
78
if [[ ! -e /etc/gitlab/gitlab.rb ]]; then
49
79
echo " Installing gitlab.rb config..."
@@ -73,20 +103,14 @@ echo "Preparing services..."
73
103
rm -f /opt/gitlab/service/*
74
104
ln -s /opt/gitlab/sv/sshd /opt/gitlab/service
75
105
ln -sf /opt/gitlab/embedded/bin/sv /opt/gitlab/init/sshd
106
+ mkdir -p /var/run/sshd
76
107
mkdir -p /var/log/gitlab/sshd
108
+ mkdir -p /var/log/gitlab/reconfigure
77
109
78
110
# Start service manager
79
111
echo " Starting services..."
80
112
GITLAB_OMNIBUS_CONFIG= /opt/gitlab/embedded/bin/runsvdir-start &
81
113
82
- # Configure gitlab package
83
- # WARNING:
84
- # the preinst script has the database backup
85
- # It will not be executed, because all services are not yet started
86
- # They will be started when `reconfigure` is executed
87
- echo " Configuring GitLab package..."
88
- /var/lib/dpkg/info/${RELEASE_PACKAGE} .preinst upgrade
89
-
90
114
echo " Configuring GitLab..."
91
115
gitlab-ctl reconfigure
92
116
@@ -97,7 +121,7 @@ if [ "${GITLAB_SKIP_PG_UPGRADE}" != true ]; then
97
121
fi
98
122
99
123
if [ -n " ${GITLAB_POST_RECONFIGURE_SCRIPT+x} " ]; then
100
- echo " Runnning Post Reconfigure Script..."
124
+ echo " Running Post Reconfigure Script..."
101
125
eval " ${GITLAB_POST_RECONFIGURE_SCRIPT} "
102
126
fi
103
127
0 commit comments