Home > Enterprise >  Is it possible to restore Gitlab-CE from files from previous installation?
Is it possible to restore Gitlab-CE from files from previous installation?

Time:10-24

recently I was forced to migrate from VPS hosting I had. I was away from home when I was asked to perform backups before the end of lease, so I had no time to backup all of the data in a way that backup should've been performed and that left me with all of my VPS data packed into a single .tar.gz.

Almost everything went smooth, the last thing that gives me nightmares is restoring my previous Gitlab-CE data.

This time I went with the dockerized version of Gitlab-CE. (gitlab/gitlab-ce:12.4.0-ce.0)

To be sure that I am not using wrong version during this process, I extracted which version I had installed from one of license files found in the backup.

I have confirmed that this image works without my data being mounted to volumes, but whenever I've tried to mount volumes recovered from backup:

/home/gitlab/logs:/var/log/gitlab

/home/gitlab/data:/var/opt/gitlab

/home/gitlab/config:/etc/gitlab

I was stuck with a fatal error regarding postgres db:

[execute] psql: FATAL: database locale is incompatible with operating system

DETAIL: The database was initialized with LC_COLLATE "en_US.UTF-8", which is not recognized by setlocale().

HINT: Recreate the database with another locale or install the missing locale.

I have tried setting ENV variables LANG, LANGUAGE, LC_ALL to different values without any luck.

I was not able to find solution on the internet so far, I wish I could've made a backup properly.

My wish is to restore old repositories (and if possible user accounts) from old installation I have stored.

Anything that could lead me into possible solution is very much appreciated!

This is my first question on stack so please forgive me if it is formed improperly, or is being asked in a wrong section.

CodePudding user response:

Solution marked as an accepted answer worked beautifully, for further readers and to summarize, what was the final solution:

I have created an image using Dockerfile based on specific version of official gitlab-ce docker image and included locales packages.

Dockerfile in question:

FROM gitlab/gitlab-ce:12.4.0-ce.0

# Update packages
RUN apt-get update

# Install common software to aquire add-apt-repository command
RUN apt-get -y install software-properties-common

# Update packages
RUN apt-get update

# Add universe repository to get access to locales package
RUN add-apt-repository universe

# Update packages
RUN apt-get update

# Install missing locales & generate en_US one
RUN apt-get -y install -yqq locales locales-all tzdata && locale-gen en_US.UTF-8

# Continue with official gitlab-ce commands from their image...
# Wrapper to handle signal, trigger runit and reconfigure GitLab
CMD ["/assets/wrapper"]

HEALTHCHECK --interval=60s --timeout=30s --retries=5 \
CMD /opt/gitlab/bin/gitlab-healthcheck --fail --max-time 10

Then it was just simple

docker build - < Dockerfile

If it is bloated, or something is not necessary feel free to correct me, otherwise it is what worked for me in the end.

Thanks once again to @Vonc for providing me with what lead to the final solution!

CodePudding user response:

As in this thread, try and check if locales/tzdata are missing:

apt-get update && apt-get install -yqq locales tzdata && locale-gen en_US.UTF-8

This is similar to postgres-ai/custom-images issues/4, which means, if it works at runtime, you might have to build your own GitLab image, with:

RUN apt-get install -yqq locales locales-all tzdata && locale-gen en_US.UTF-8
  • Related