]> git.pld-linux.org Git - packages/gitlab-ce.git/blame - gitlab-ctl.sh
apache: fix docroot; update log path
[packages/gitlab-ce.git] / gitlab-ctl.sh
CommitLineData
e62d7f31
ER
1#!/bin/sh
2#
3# gitlab-ctl implementing similar commands as gitlab omnibus package does
4#
5set -e
6
7auto_migrations_skip_file=/etc/gitlab/skip-auto-migrations
8
9die() {
10 cat >&2
11 exit 1
12}
13
fd773272
ER
14notice() {
15 echo "gitlab $*"
16}
17
a6fcdc58
ER
18# Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
19upgrade() {
20 gitlab-rake db:migrate "$@"
21}
22
23# GitLab | Create a backup of the GitLab system
24backup() {
25 gitlab-rake gitlab:backup:create "$@"
26}
27
28# http://docs.gitlab.com/ce/administration/restart_gitlab.html#installations-from-source
29restart() {
30 :
31}
32
e62d7f31
ER
33# Run backup before package upgrade
34# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/8.8.1+ce.0/config/templates/package-scripts/preinst.erb#L10
a6fcdc58
ER
35preinst() {
36 if [ -f $auto_migrations_skip_file ]; then
fd773272 37 notice "preinstall: Found $auto_migrations_skip_file, skipping auto backup..."
a6fcdc58
ER
38 return
39 fi
40
fd773272
ER
41 notice "preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!)"
42
a6fcdc58 43 if ! backup SKIP=repositories,uploads,builds,artifacts,lfs,registry; then
e62d7f31
ER
44 cat >&2 <<-EOF
45
46 Backup failed! If you want to skip this backup, run the following command and try again:
47
48 touch ${auto_migrations_skip_file}
49
50 EOF
51 exit 1
52 fi
53}
54
55# Run migrations after a package upgrade
a6fcdc58 56# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/8.8.1+ce.0/config/templates/package-scripts/posttrans.erb
e62d7f31 57# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/8.8.1+ce.0/files/gitlab-ctl-commands/upgrade.rb
a6fcdc58 58posttrans() {
e62d7f31
ER
59 upgrade
60
61 cat >&2 <<-EOF
62 Upgrade complete!
63
64 If you need to roll back to the previous version you can
65 use the database backup made during the upgrade (scroll up for the filename).
66 EOF
e62d7f31
ER
67}
68
69case "$1" in
a6fcdc58
ER
70preinst)
71 preinst
72 ;;
73posttrans)
74 posttrans
75 ;;
76backup)
77 backup "$@"
e62d7f31
ER
78 ;;
79upgrade)
80 upgrade
81 ;;
82esac
This page took 0.039903 seconds and 4 git commands to generate.