GitLab Migration: Yunohost CE to EE
Overview
This guide covers migrating a GitLab instance from Yunohost to a standalone server, including:
- Data migration from Yunohost
- User migration from LDAP to local authentication
- Upgrade from Community Edition (CE) to Enterprise Edition (EE)
1. Create and Transfer Backups
On the Yunohost server:
# Create GitLab backup
sudo gitlab-backup create
# Copy the three required files to new server (run these from the new server)
scp user@old-server:/home/yunohost.backup/archives/[TIMESTAMP]_gitlab_backup.tar user@new-server:/tmp/
scp user@old-server:/etc/gitlab/gitlab.rb user@new-server:/tmp/
scp user@old-server:/etc/gitlab/gitlab-secrets.json user@new-server:/tmp/
2. Set Up New Server
Initial Package Setup
# Update package list
sudo apt-get update
# Install required packages
sudo apt-get install -y curl openssh-server ca-certificates perl postfix git
# Add both CE and EE repositories
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
# Update package list again after adding repos
sudo apt update
# Install GitLab CE first
sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ce
3. Restore Data to CE Instance
# Stop GitLab services
sudo gitlab-ctl stop
# Move the backup files to correct locations
sudo mv /tmp/gitlab.rb /etc/gitlab/
sudo mv /tmp/gitlab-secrets.json /etc/gitlab/
sudo mv /tmp/*_gitlab_backup.tar /var/opt/gitlab/backups/
# Set correct permissions
sudo chmod 600 /etc/gitlab/gitlab-secrets.json
sudo chown root:root /etc/gitlab/gitlab*
# Restore the backup
sudo gitlab-backup restore BACKUP=[TIMESTAMP]
# Reconfigure and restart GitLab
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
4. Configure Authentication Methods
First, access the Rails console:
sudo gitlab-rails console -e production
Then run these Ruby commands:
# Enable password authentication and sign-in
settings = ApplicationSetting.current
settings.update_column(:password_authentication_enabled_for_web, true)
settings.update_column(:signin_enabled, true)
# Exit console
quit
5. Migrate Users from LDAP
First, access the Rails console:
sudo gitlab-rails console -e production
Then run these Ruby commands:
# Find and update each LDAP user (repeat for each user)
user = User.find_by_username('username')
# Remove LDAP identities
user.identities.where(provider: 'ldap').destroy_all
# Reset authentication settings
if user.respond_to?(:authentication_type)
user.update_column(:authentication_type, nil)
end
# Set password expiry to far future
if user.respond_to?(:password_expires_at)
user.update_column(:password_expires_at, Time.now + 10.years)
end
# Ensure user account is active and reset login attempts
user.update_columns(
state: 'active',
failed_attempts: 0
)
# Set new password
user.password = 'temporary_password'
user.password_confirmation = 'temporary_password'
user.save!
# Verify changes
puts "Active: #{user.state}"
puts "Failed attempts: #{user.failed_attempts}"
puts "Password expires at: #{user.password_expires_at}"
puts "Identities: #{user.identities.pluck(:provider)}"
# Exit console
quit
Alternative password reset method:
sudo gitlab-rake "gitlab:password:reset[username]"
6. Verify CE Installation
- Verify GitLab CE is accessible via web browser
- Test user login with the new passwords
- Have users change their temporary passwords
- Confirm repositories and data are present
- Create a test issue and commit to verify functionality
7. Upgrade to Enterprise Edition
Only proceed after confirming CE is working correctly:
# Upgrade to GitLab EE
sudo apt install gitlab-ee
8. Install GitLab EE License
- Generate and install the license
- Navigate to Admin Area > Settings > General
- Upload your license file
- Accept Terms of Service
- Click "Add License"
9. Final Configuration
# Edit GitLab configuration
sudo nano /etc/gitlab/gitlab.rb
# Add these lines:
gitlab_rails['usage_ping_enabled'] = false
gitlab_rails['gitlab_url'] = 'http://your.gitlab.url'
# Reconfigure and restart
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
Troubleshooting
# View logs
sudo gitlab-ctl tail
# Check GitLab status
sudo gitlab-ctl status
# If PostgreSQL issues occur
sudo mv /var/opt/gitlab/postgresql/data /var/opt/gitlab/postgresql/data.bak
sudo mkdir -p /var/opt/gitlab/postgresql/data
sudo chown -R gitlab-psql:gitlab-psql /var/opt/gitlab/postgresql/data
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart postgresql
Remember to:
- Replace placeholders with your actual values
- Document temporary passwords
- Keep track of migrated users
- Keep old server running until migration is confirmed
- Backup before each major step
- Test thoroughly after each configuration change