2019-05-24 04:03:22 -04:00
|
|
|
---
|
|
|
|
type: howto
|
|
|
|
---
|
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
# Migrate GitLab CI to GitLab CE or EE
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-17 16:24:00 -04:00
|
|
|
Beginning with version 8.0 of GitLab Community Edition (CE) and Enterprise
|
|
|
|
Edition (EE), GitLab CI is no longer its own application, but is instead built
|
|
|
|
into the CE and EE applications.
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-17 16:24:00 -04:00
|
|
|
This guide will detail the process of migrating your CI installation and data
|
2015-09-22 07:59:22 -04:00
|
|
|
into your GitLab CE or EE installation. **You can only migrate CI data from
|
|
|
|
GitLab CI 8.0 to GitLab 8.0; migrating between other versions (e.g.7.14 to 8.1)
|
|
|
|
is not possible.**
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
We recommend that you read through the entire migration process in this
|
|
|
|
document before beginning.
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
## Overview
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
In this document we assume you have a GitLab server and a GitLab CI server. It
|
|
|
|
does not matter if these are the same machine.
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
The migration consists of three parts: updating GitLab and GitLab CI, moving
|
|
|
|
data, and redirecting traffic.
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
Please note that CI builds triggered on your GitLab server in the time between
|
2015-09-22 07:59:40 -04:00
|
|
|
updating to 8.0 and finishing the migration will be lost. Your GitLab server
|
|
|
|
can be online for most of the procedure; the only GitLab downtime (if any) is
|
|
|
|
during the upgrade to 8.0. Your CI service will be offline from the moment you
|
|
|
|
upgrade to 8.0 until you finish the migration procedure.
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
## Before upgrading
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2019-08-29 04:50:59 -04:00
|
|
|
If you have GitLab CI installed using Omnibus GitLab packages but **you don't want to migrate your existing data**:
|
2015-09-22 10:57:43 -04:00
|
|
|
|
|
|
|
```bash
|
|
|
|
mv /var/opt/gitlab/gitlab-ci/builds /var/opt/gitlab/gitlab-ci/builds.$(date +%s)
|
|
|
|
```
|
|
|
|
|
2015-10-05 10:39:58 -04:00
|
|
|
run `sudo gitlab-ctl reconfigure` and you can reach CI at `gitlab.example.com/ci`.
|
|
|
|
|
|
|
|
If you want to migrate your existing data, continue reading.
|
2015-09-22 10:57:43 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 0. Updating Omnibus from versions prior to 7.13
|
2015-10-01 05:34:29 -04:00
|
|
|
|
|
|
|
If you are updating from older versions you should first update to 7.14 and then to 8.0.
|
|
|
|
Otherwise it's pretty likely that you will encounter problems described in the [Troubleshooting](#troubleshooting).
|
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 1. Verify that backups work
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Make sure that the backup script on both servers can connect to the database.
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your CI server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
2015-10-01 05:34:29 -04:00
|
|
|
sudo chown gitlab-ci:gitlab-ci /var/opt/gitlab/gitlab-ci/builds
|
2015-09-22 07:33:02 -04:00
|
|
|
sudo gitlab-ci-rake backup:create
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
cd /home/gitlab_ci/gitlab-ci
|
|
|
|
sudo -u gitlab_ci -H bundle exec rake backup:create RAILS_ENV=production
|
|
|
|
```
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2015-09-22 07:40:44 -04:00
|
|
|
Also check on your GitLab server.
|
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your GitLab server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
2019-08-06 19:14:52 -04:00
|
|
|
sudo gitlab-backup create SKIP=repositories,uploads
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
cd /home/git/gitlab
|
|
|
|
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production SKIP=repositories,uploads
|
|
|
|
```
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
If this fails you need to fix it before upgrading to 8.0. Also see
|
2019-01-24 01:52:33 -05:00
|
|
|
<https://about.gitlab.com/get-help/>
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2019-09-09 23:44:34 -04:00
|
|
|
NOTE: **Note**
|
|
|
|
For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`.
|
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 2. Check source and target database types
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Check what databases you use on your GitLab server and your CI server.
|
2015-09-22 07:33:02 -04:00
|
|
|
Look for the 'adapter:' line. If your CI server and your GitLab server use
|
|
|
|
the same database adapter no special care is needed. If your CI server uses
|
|
|
|
MySQL and your GitLab server uses PostgreSQL you need to pass a special option
|
|
|
|
during the 'Moving data' part. **If your CI server uses PostgreSQL and your
|
2015-09-22 07:42:47 -04:00
|
|
|
GitLab server uses MySQL you cannot migrate your CI data to GitLab 8.0.**
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your CI server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
|
|
|
sudo gitlab-ci-rake env:info
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
cd /home/gitlab_ci/gitlab-ci
|
|
|
|
sudo -u gitlab_ci -H bundle exec rake env:info RAILS_ENV=production
|
|
|
|
```
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your GitLab server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
|
|
|
sudo gitlab-rake gitlab:env:info
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
cd /home/git/gitlab
|
|
|
|
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
|
|
|
|
```
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 3. Storage planning
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Decide where to store CI build traces on GitLab server. GitLab CI uses
|
2015-09-22 07:42:47 -04:00
|
|
|
files on disk to store CI build traces. The default path for these build
|
2015-09-22 07:44:43 -04:00
|
|
|
traces is `/var/opt/gitlab/gitlab-ci/builds` (Omnibus) or
|
2015-09-22 07:42:47 -04:00
|
|
|
`/home/git/gitlab/builds` (Source). If you are storing your repository data in
|
|
|
|
a special location, or if you are using NFS, you should make sure that you
|
|
|
|
store build traces on the same storage as your Git repositories.
|
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
## I. Upgrading
|
2015-09-16 05:08:48 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
From this point on, GitLab CI will be unavailable for your end users.
|
2015-09-21 16:47:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 1. Upgrade GitLab to 8.0
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
First upgrade your GitLab server to version 8.0:
|
2019-01-24 01:52:33 -05:00
|
|
|
<https://about.gitlab.com/update/>
|
2015-09-22 08:49:39 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 2. Disable CI on the GitLab server during the migration
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
After you update, go to the admin panel and temporarily disable CI. As
|
2015-09-22 07:33:02 -04:00
|
|
|
an administrator, go to **Admin Area** -> **Settings**, and under
|
|
|
|
**Continuous Integration** uncheck **Disable to prevent CI usage until rake
|
|
|
|
ci:migrate is run (8.0 only)**.
|
2015-09-22 08:49:39 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 3. CI settings are now in GitLab
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
If you want to use custom CI settings (e.g. change where builds are
|
2015-09-22 07:33:02 -04:00
|
|
|
stored), please update `/etc/gitlab/gitlab.rb` (Omnibus) or
|
|
|
|
`/home/git/gitlab/config/gitlab.yml` (Source).
|
2015-09-22 08:49:39 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 4. Upgrade GitLab CI to 8.0
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Now upgrade GitLab CI to version 8.0. If you are using Omnibus packages,
|
2015-09-22 07:33:02 -04:00
|
|
|
this may have already happened when you upgraded GitLab to 8.0.
|
2015-09-21 16:47:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 5. Disable GitLab CI on the CI server
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Disable GitLab CI after upgrading to 8.0.
|
2015-09-21 18:46:20 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your CI server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
|
|
|
sudo gitlab-ctl stop ci-unicorn
|
|
|
|
sudo gitlab-ctl stop ci-sidekiq
|
|
|
|
|
|
|
|
# Source
|
|
|
|
sudo service gitlab_ci stop
|
|
|
|
cd /home/gitlab_ci/gitlab-ci
|
2015-09-30 09:30:13 -04:00
|
|
|
sudo -u gitlab_ci -H bundle exec whenever --clear-crontab RAILS_ENV=production
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
## II. Moving data
|
2015-09-16 05:08:48 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 1. Database encryption key
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Move the database encryption key from your CI server to your GitLab
|
2015-09-22 07:52:53 -04:00
|
|
|
server. The command below will show you what you need to copy-paste to your
|
|
|
|
GitLab server. On Omnibus GitLab servers you will have to add a line to
|
|
|
|
`/etc/gitlab/gitlab.rb`. On GitLab servers installed from source you will have
|
|
|
|
to replace the contents of `/home/git/gitlab/config/secrets.yml`.
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your CI server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
|
|
|
sudo gitlab-ci-rake backup:show_secrets
|
2015-09-16 05:08:48 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
cd /home/gitlab_ci/gitlab-ci
|
|
|
|
sudo -u gitlab_ci -H bundle exec rake backup:show_secrets RAILS_ENV=production
|
|
|
|
```
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 2. SQL data and build traces
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Create your final CI data export. If you are converting from MySQL to
|
2019-07-14 23:02:30 -04:00
|
|
|
PostgreSQL, add `MYSQL_TO_POSTGRESQL=1` to the end of the rake command. When
|
2015-09-22 07:33:02 -04:00
|
|
|
the command finishes it will print the path to your data export archive; you
|
|
|
|
will need this file later.
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2015-09-21 18:46:20 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your CI server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
2015-10-02 06:44:20 -04:00
|
|
|
sudo chown gitlab-ci:gitlab-ci /var/opt/gitlab/gitlab-ci/builds
|
2015-09-22 07:33:02 -04:00
|
|
|
sudo gitlab-ci-rake backup:create
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
2015-09-22 16:25:23 -04:00
|
|
|
cd /home/gitlab_ci/gitlab-ci
|
|
|
|
sudo -u gitlab_ci -H bundle exec rake backup:create RAILS_ENV=production
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-21 16:36:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 3. Copy data to the GitLab server
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
If you were running GitLab and GitLab CI on the same server you can skip this
|
|
|
|
step.
|
|
|
|
|
|
|
|
Copy your CI data archive to your GitLab server. There are many ways to do
|
|
|
|
this, below we use SSH agent forwarding and 'scp', which will be easy and fast
|
|
|
|
for most setups. You can also copy the data archive first from the CI server to
|
|
|
|
your laptop and then from your laptop to the GitLab server.
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
|
|
|
# Start from your laptop
|
|
|
|
ssh -A ci_admin@ci_server.example
|
|
|
|
# Now on the CI server
|
|
|
|
scp /path/to/12345_gitlab_ci_backup.tar gitlab_admin@gitlab_server.example:~
|
2015-09-21 18:46:20 -04:00
|
|
|
```
|
2015-09-21 16:36:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 4. Move data to the GitLab backups folder
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
Make the CI data archive discoverable for GitLab. We assume below that you
|
|
|
|
store backups in the default path, adjust the command if necessary.
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your GitLab server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
|
|
|
sudo mv /path/to/12345_gitlab_ci_backup.tar /var/opt/gitlab/backups/
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
sudo mv /path/to/12345_gitlab_ci_backup.tar /home/git/gitlab/tmp/backups/
|
|
|
|
```
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2019-08-22 04:50:31 -04:00
|
|
|
### 5. Import the CI data into GitLab
|
2015-09-22 08:49:39 -04:00
|
|
|
|
|
|
|
This step will delete any existing CI data on your GitLab server. There should
|
|
|
|
be no CI data yet because you turned CI on the GitLab server off earlier.
|
2015-09-20 18:55:47 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your GitLab server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
2015-10-02 06:44:20 -04:00
|
|
|
sudo chown git:git /var/opt/gitlab/gitlab-ci/builds
|
2015-09-22 07:33:02 -04:00
|
|
|
sudo gitlab-rake ci:migrate
|
2015-09-16 05:08:48 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
cd /home/git/gitlab
|
|
|
|
sudo -u git -H bundle exec rake ci:migrate RAILS_ENV=production
|
|
|
|
```
|
2015-09-21 21:10:57 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### 6. Restart GitLab
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
```
|
2015-09-22 09:26:40 -04:00
|
|
|
# On your GitLab server:
|
2015-09-22 07:33:02 -04:00
|
|
|
# Omnibus
|
|
|
|
sudo gitlab-ctl hup unicorn
|
|
|
|
sudo gitlab-ctl restart sidekiq
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
# Source
|
|
|
|
sudo service gitlab reload
|
|
|
|
```
|
2015-09-21 18:02:50 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
## III. Redirecting traffic
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
If you were running GitLab CI with Omnibus packages and you were using the
|
|
|
|
internal NGINX configuration your CI service should now be available both at
|
2015-09-22 08:54:26 -04:00
|
|
|
`ci.example.com` (the old address) and `gitlab.example.com/ci`. **You are done!**
|
2015-09-17 16:24:00 -04:00
|
|
|
|
2015-09-22 07:33:02 -04:00
|
|
|
If you installed GitLab CI from source we now need to configure a redirect in
|
|
|
|
NGINX so that existing CI runners can keep using the old CI server address, and
|
|
|
|
so that existing links to your CI server keep working.
|
2015-09-21 16:47:33 -04:00
|
|
|
|
2019-10-02 08:06:04 -04:00
|
|
|
### 1. Update NGINX configuration
|
2015-09-17 16:24:00 -04:00
|
|
|
|
|
|
|
To ensure that your existing CI runners are able to communicate with the
|
|
|
|
migrated installation, and that existing build triggers still work, you'll need
|
2019-10-02 08:06:04 -04:00
|
|
|
to update your NGINX configuration to redirect requests for the old locations to
|
2015-09-17 16:24:00 -04:00
|
|
|
the new ones.
|
|
|
|
|
|
|
|
Edit `/etc/nginx/sites-available/gitlab_ci` and paste:
|
|
|
|
|
|
|
|
```nginx
|
|
|
|
# GITLAB CI
|
|
|
|
server {
|
|
|
|
listen 80 default_server; # e.g., listen 192.168.1.1:80;
|
|
|
|
server_name YOUR_CI_SERVER_FQDN; # e.g., server_name source.example.com;
|
|
|
|
|
|
|
|
access_log /var/log/nginx/gitlab_ci_access.log;
|
|
|
|
error_log /var/log/nginx/gitlab_ci_error.log;
|
|
|
|
|
|
|
|
# expose API to fix runners
|
|
|
|
location /api {
|
|
|
|
proxy_read_timeout 300;
|
|
|
|
proxy_connect_timeout 300;
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
|
|
|
# You need to specify your DNS servers that are able to resolve YOUR_GITLAB_SERVER_FQDN
|
|
|
|
resolver 8.8.8.8 8.8.4.4;
|
|
|
|
proxy_pass $scheme://YOUR_GITLAB_SERVER_FQDN/ci$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
# redirect all other CI requests
|
|
|
|
location / {
|
|
|
|
return 301 $scheme://YOUR_GITLAB_SERVER_FQDN/ci$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
# adjust this to match the largest build log your runners might submit,
|
|
|
|
# set to 0 to disable limit
|
|
|
|
client_max_body_size 10m;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Make sure you substitute these placeholder values with your real ones:
|
|
|
|
|
|
|
|
1. `YOUR_CI_SERVER_FQDN`: The existing public-facing address of your GitLab CI
|
|
|
|
install (e.g., `ci.gitlab.com`).
|
|
|
|
1. `YOUR_GITLAB_SERVER_FQDN`: The current public-facing address of your GitLab
|
|
|
|
CE (or EE) install (e.g., `gitlab.com`).
|
|
|
|
|
2015-09-20 18:55:47 -04:00
|
|
|
**Make sure not to remove the `/ci$request_uri` part. This is required to
|
|
|
|
properly forward the requests.**
|
2015-09-17 16:24:00 -04:00
|
|
|
|
|
|
|
You should also make sure that you can:
|
|
|
|
|
2015-09-16 05:08:48 -04:00
|
|
|
1. `curl https://YOUR_GITLAB_SERVER_FQDN/` from your previous GitLab CI server.
|
2015-09-17 16:24:00 -04:00
|
|
|
1. `curl https://YOUR_CI_SERVER_FQDN/` from your GitLab CE (or EE) server.
|
2015-09-16 05:08:48 -04:00
|
|
|
|
2019-10-02 08:06:04 -04:00
|
|
|
### 2. Check NGINX configuration
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2019-07-14 23:02:30 -04:00
|
|
|
```sh
|
|
|
|
sudo nginx -t
|
|
|
|
```
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2019-10-02 08:06:04 -04:00
|
|
|
### 3. Restart NGINX
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2019-07-14 23:02:30 -04:00
|
|
|
```sh
|
|
|
|
sudo /etc/init.d/nginx restart
|
|
|
|
```
|
2015-09-16 04:58:33 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### Restore from backup
|
2015-09-21 18:46:20 -04:00
|
|
|
|
|
|
|
If something went wrong and you need to restore a backup, consult the [Backup
|
|
|
|
restoration](../raketasks/backup_restore.md) guide.
|
2015-10-01 05:34:29 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
## Troubleshooting
|
2015-10-01 05:34:29 -04:00
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### show:secrets problem (Omnibus-only)
|
2019-05-24 04:03:22 -04:00
|
|
|
|
2015-10-01 05:34:29 -04:00
|
|
|
If you see errors like this:
|
2019-05-24 04:03:22 -04:00
|
|
|
|
2015-10-01 05:34:29 -04:00
|
|
|
```
|
|
|
|
Missing `secret_key_base` or `db_key_base` for 'production' environment. The secrets will be generated and stored in `config/secrets.yml`
|
|
|
|
rake aborted!
|
|
|
|
Errno::EACCES: Permission denied @ rb_sysopen - config/secrets.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
This can happen if you are updating from versions prior to 7.13 straight to 8.0.
|
|
|
|
The fix for this is to update to Omnibus 7.14 first and then update it to 8.0.
|
|
|
|
|
2019-08-29 04:50:59 -04:00
|
|
|
### Permission denied when accessing `/var/opt/gitlab/gitlab-ci/builds`
|
2019-05-24 04:03:22 -04:00
|
|
|
|
2015-10-01 05:34:29 -04:00
|
|
|
To fix that issue you have to change builds/ folder permission before doing final backup:
|
2019-07-14 23:02:30 -04:00
|
|
|
|
2015-10-01 05:34:29 -04:00
|
|
|
```
|
2015-10-02 06:44:20 -04:00
|
|
|
sudo chown -R gitlab-ci:gitlab-ci /var/opt/gitlab/gitlab-ci/builds
|
|
|
|
```
|
|
|
|
|
|
|
|
Then before executing `ci:migrate` you need to fix builds folder permission:
|
2019-07-14 23:02:30 -04:00
|
|
|
|
2015-10-02 06:44:20 -04:00
|
|
|
```
|
|
|
|
sudo chown git:git /var/opt/gitlab/gitlab-ci/builds
|
2015-10-01 05:34:29 -04:00
|
|
|
```
|
|
|
|
|
2017-04-26 09:13:11 -04:00
|
|
|
### Problems when importing CI database to GitLab
|
2019-05-24 04:03:22 -04:00
|
|
|
|
2016-05-30 01:34:58 -04:00
|
|
|
If you were migrating CI database from MySQL to PostgreSQL manually you can see errors during import about missing sequences:
|
2019-05-24 04:03:22 -04:00
|
|
|
|
2019-07-14 23:02:30 -04:00
|
|
|
```sql
|
2015-10-01 05:34:29 -04:00
|
|
|
ALTER SEQUENCE
|
|
|
|
ERROR: relation "ci_builds_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_commits_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_events_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_jobs_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_projects_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_runner_projects_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_runners_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_services_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_taggings_id_seq" does not exist
|
|
|
|
ERROR: relation "ci_tags_id_seq" does not exist
|
|
|
|
CREATE TABLE
|
|
|
|
```
|
|
|
|
|
|
|
|
To fix that you need to apply this SQL statement before doing final backup:
|
2017-11-01 11:56:40 -04:00
|
|
|
|
2019-05-24 04:03:22 -04:00
|
|
|
Omnibus GitLab installations:
|
2017-11-01 11:56:40 -04:00
|
|
|
|
2019-05-24 04:03:22 -04:00
|
|
|
```sql
|
2015-10-01 05:34:29 -04:00
|
|
|
gitlab-ci-rails dbconsole <<EOF
|
|
|
|
-- ALTER TABLES - DROP DEFAULTS
|
|
|
|
ALTER TABLE ONLY ci_application_settings ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_builds ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_commits ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_events ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_jobs ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_projects ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_runner_projects ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_runners ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_services ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_taggings ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_tags ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_trigger_requests ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_triggers ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_variables ALTER COLUMN id DROP DEFAULT;
|
|
|
|
ALTER TABLE ONLY ci_web_hooks ALTER COLUMN id DROP DEFAULT;
|
|
|
|
|
|
|
|
-- ALTER SEQUENCES
|
|
|
|
ALTER SEQUENCE ci_application_settings_id_seq OWNED BY ci_application_settings.id;
|
|
|
|
ALTER SEQUENCE ci_builds_id_seq OWNED BY ci_builds.id;
|
|
|
|
ALTER SEQUENCE ci_commits_id_seq OWNED BY ci_commits.id;
|
|
|
|
ALTER SEQUENCE ci_events_id_seq OWNED BY ci_events.id;
|
|
|
|
ALTER SEQUENCE ci_jobs_id_seq OWNED BY ci_jobs.id;
|
|
|
|
ALTER SEQUENCE ci_projects_id_seq OWNED BY ci_projects.id;
|
|
|
|
ALTER SEQUENCE ci_runner_projects_id_seq OWNED BY ci_runner_projects.id;
|
|
|
|
ALTER SEQUENCE ci_runners_id_seq OWNED BY ci_runners.id;
|
|
|
|
ALTER SEQUENCE ci_services_id_seq OWNED BY ci_services.id;
|
|
|
|
ALTER SEQUENCE ci_taggings_id_seq OWNED BY ci_taggings.id;
|
|
|
|
ALTER SEQUENCE ci_tags_id_seq OWNED BY ci_tags.id;
|
|
|
|
ALTER SEQUENCE ci_trigger_requests_id_seq OWNED BY ci_trigger_requests.id;
|
|
|
|
ALTER SEQUENCE ci_triggers_id_seq OWNED BY ci_triggers.id;
|
|
|
|
ALTER SEQUENCE ci_variables_id_seq OWNED BY ci_variables.id;
|
|
|
|
ALTER SEQUENCE ci_web_hooks_id_seq OWNED BY ci_web_hooks.id;
|
|
|
|
|
|
|
|
-- ALTER TABLES - RE-APPLY DEFAULTS
|
|
|
|
ALTER TABLE ONLY ci_application_settings ALTER COLUMN id SET DEFAULT nextval('ci_application_settings_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_builds ALTER COLUMN id SET DEFAULT nextval('ci_builds_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_commits ALTER COLUMN id SET DEFAULT nextval('ci_commits_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_events ALTER COLUMN id SET DEFAULT nextval('ci_events_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_jobs ALTER COLUMN id SET DEFAULT nextval('ci_jobs_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_projects ALTER COLUMN id SET DEFAULT nextval('ci_projects_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_runner_projects ALTER COLUMN id SET DEFAULT nextval('ci_runner_projects_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_runners ALTER COLUMN id SET DEFAULT nextval('ci_runners_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_services ALTER COLUMN id SET DEFAULT nextval('ci_services_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_taggings ALTER COLUMN id SET DEFAULT nextval('ci_taggings_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_tags ALTER COLUMN id SET DEFAULT nextval('ci_tags_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_trigger_requests ALTER COLUMN id SET DEFAULT nextval('ci_trigger_requests_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_triggers ALTER COLUMN id SET DEFAULT nextval('ci_triggers_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_variables ALTER COLUMN id SET DEFAULT nextval('ci_variables_id_seq'::regclass);
|
|
|
|
ALTER TABLE ONLY ci_web_hooks ALTER COLUMN id SET DEFAULT nextval('ci_web_hooks_id_seq'::regclass);
|
|
|
|
EOF
|
2019-05-24 04:03:22 -04:00
|
|
|
```
|
2015-10-01 05:34:29 -04:00
|
|
|
|
2019-05-24 04:03:22 -04:00
|
|
|
Source installations:
|
2017-11-01 11:56:40 -04:00
|
|
|
|
2019-05-24 04:03:22 -04:00
|
|
|
```
|
2015-10-01 05:34:29 -04:00
|
|
|
cd /home/gitlab_ci/gitlab-ci
|
|
|
|
sudo -u gitlab_ci -H bundle exec rails dbconsole production <<EOF
|
|
|
|
... COPY SQL STATEMENTS FROM ABOVE ...
|
|
|
|
EOF
|
|
|
|
```
|