-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost_setup.sh
More file actions
executable file
·52 lines (43 loc) · 1.41 KB
/
post_setup.sh
File metadata and controls
executable file
·52 lines (43 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
start=$SECONDS
# get variables from .env file
export $(grep -v '^#' .env | xargs)
echo "Configuring (can take some time...)"
# Run docker command
docker exec -it gitlab gitlab-rails runner "
# Disable user signups
ApplicationSetting.last.update(signup_enabled: false)
# Disable auto_devops
ApplicationSetting.last.update(auto_devops_enabled: false)
# Change root email
if user = User.find_by_username('root')
user.email = '${git_user_email}'
user.skip_reconfirmation!
user.save!
end
# Create a user
User.create(
:name => '${defaultuser_name}',
:username => '${defaultuser_username}',
:email => '${defaultuser_email}',
:password => '${defaultuser_password}',
:password_confirmation => '${defaultuser_password}',
:admin => '${defaultuser_admin}'
)
# Send a test mail
Notify.test_email('${test_email_to}', 'Gitlab server is configured!', 'This message means your gitlab server is configured!').deliver_now
"
# show how much time this took...
DURATION=$(( SECONDS - START ))
if (( $DURATION > 3600 )) ; then
let "hours=DURATION/3600"
let "minutes=(DURATION%3600)/60"
let "seconds=(DURATION%3600)%60"
echo "Completed in $hours hour(s), $minutes minute(s) and $seconds second(s)"
elif (( $DURATION > 60 )) ; then
let "minutes=(DURATION%3600)/60"
let "seconds=(DURATION%3600)%60"
echo "Completed in $minutes minute(s) and $seconds second(s)"
else
echo "Completed in $DURATION seconds"
fi