Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15.11-stable, Restore unavailable #16

Open
supar opened this issue Jun 29, 2023 · 4 comments
Open

15.11-stable, Restore unavailable #16

supar opened this issue Jun 29, 2023 · 4 comments

Comments

@supar
Copy link

supar commented Jun 29, 2023

The entrypoint.sh script currently does not include any available restore methods. Having a restore method is essential for server migration purposes.
If you attempt to perform a migration from a container using the shell command docker compose exec gitlab sh, you may encounter the following error:

Backup::Error: gitaly-backup binary not found and gitaly_backup_path is not configured

This error occurs because the GitLab main image does not include the gitaly_backup binary from the gitaly image, which is required for the restore process.

Please note that in the prepare_dirs() method, the following directories are also required for installation during the restore scenario:

/home/git/gitlab/shared/terraform_state
/home/git/gitlab/shared/packages
@Ikke
Copy link
Contributor

Ikke commented Jul 1, 2023

I've never used the restore feature of gitlab, so I'd have to look into how to support that.

@supar
Copy link
Author

supar commented Jul 4, 2023

I have a makeshift solution

Dockerfile

--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,9 @@
 ARG ALPINE_VERSION
 ARG RUBY_VERSION
 ARG GITLAB_SHELL_VERSION
+ARG GITALY_SERVER_VERSION
 FROM alpinelinux/gitlab-shell:${GITLAB_SHELL_VERSION} as gitlab-shell
+FROM alpinelinux/gitaly:${GITALY_SERVER_VERSION} as gitaly

 FROM ruby:$RUBY_VERSION-alpine$ALPINE_VERSION

@@ -10,6 +12,7 @@ ENV GITLAB_VERSION=$GITLAB_VERSION

 COPY overlay /
 COPY --from=gitlab-shell /home/git/gitlab-shell /home/git/gitlab-shell
+COPY --from=gitaly /usr/local/bin/gitaly-backup /usr/local/bin/gitaly-backup

 RUN setup.sh

Taskfile

--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -119,6 +119,7 @@ tasks:
     deps:
       - .build-args
       - build-gitlab-shell
+      - build-gitaly
       - deploy-libs-gitlab
     sources:
       - build-args.env
@@ -150,6 +151,7 @@ tasks:
       - build-args.env
       - gitaly/*
       - gitaly/**/*
+    run: once
     status:
       - docker image inspect {{.GITALY_IMAGE}}
   save-image-gitaly:

docker-compose.yml

--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,6 +9,7 @@ services:
         - RUBY_VERSION
         - GITLAB_VERSION
         - GITLAB_SHELL_VERSION
+        - GITALY_SERVER_VERSION
     hostname: ${GITLAB_HOSTNAME:-gitlab}
     restart: always
     ports:

But there is problem with tar utility. While gitlab restores data it fails

rake aborted!
Backup::Error: Restore operation failed: tar: unrecognized option: unlink-first
BusyBox v1.35.0 (2022-08-01 15:14:44 UTC) multi-call binary.

Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE] [LONGOPT]... [FILE]...

Create, extract, or list files from a tar file

	c	Create
	x	Extract
	t	List
...

But if install full version of tar (add to setup.sh)

# add runtime dependencies
apk add --no-cache --virtual .gitlab-runtime \
        tar \
        git \
...

than build image fails

#0 802.0 Extracting libxml2-2.10.4.tar.xz into
#0 802.0 tmp/x86_64-pc-linux-musl/ports/libxml2/2.10.4... ERROR, review
#0 802.0 '/usr/local/bundle/gems/nokogiri-1.14.3/ext/nokogiri/tmp/x86_64-pc-linux-musl/ports/libxml2/2.10.4/extract.log'
#0 802.0 to see what happened. Last lines are:
#0 802.0 ========================================================================
#0 802.0 tar (child): xz: Cannot exec: No such file or directory
#0 802.0 tar (child): Error is not recoverable: exiting now
#0 802.0 tar: Child returned status 2
#0 802.0 tar: Error is not recoverable: exiting now
#0 802.0 ========================================================================
#0 802.0 *** extconf.rb failed ***
#0 802.0 Could not create Makefile due to some reason, probably lack of necessary
#0 802.0 libraries and/or headers.  Check the mkmf.log file for more details.  You may
#0 802.0 need configuration options.
#0 802.0
#0 802.0 Provided configuration options:
#0 802.0 	--with-opt-dir
#0 802.0 	--without-opt-dir
#0 802.0 	--with-opt-include

This is some kind of mystery. May be You know how to resolve this?

@Ikke
Copy link
Contributor

Ikke commented Jul 5, 2023

You need to install xz as well to be able to unpack tar.xz

@supar
Copy link
Author

supar commented Jul 6, 2023

Yes, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants