Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions gitlab/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2026 TinyOps Studio LLC

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33 changes: 33 additions & 0 deletions gitlab/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
GO = go
EXT =

PLAKAR ?= plakar
VERSION ?= v1.0.0

GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
PTAR := gitlab_$(VERSION)_$(GOOS)_$(GOARCH).ptar

all: build

build:
${GO} build -v -o gitlabImporter${EXT} ./importer
${GO} build -v -o gitlabExporter${EXT} ./exporter

package: build
rm -f $(PTAR)
$(PLAKAR) pkg create ./manifest.yaml $(VERSION)

uninstall:
-$(PLAKAR) pkg rm gitlab

install: package
$(PLAKAR) pkg add ./$(PTAR)

reinstall: uninstall install

test:
${GO} test ./...

clean:
rm -f gitlabImporter gitlabExporter gitlab_*.ptar
76 changes: 76 additions & 0 deletions gitlab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# GitLab CE Integration for Plakar

Backup and restore a self-hosted GitLab CE instance with GitLab's native
`gitlab-backup` tooling.

The importer invokes `gitlab-backup create`, ingests the newest generated
`*_gitlab_backup.tar` archive, and includes GitLab configuration files. The
exporter writes those files to a target instance and invokes
`gitlab-backup restore`.

## Prerequisites

- Plakar >= 1.1
- GitLab CE with `gitlab-backup` available on the source and restore target
- Permission to read the GitLab backup directory and config files
- For remote operation: SSH access to the GitLab host

Use `use_sudo=true` when the account needs non-interactive sudo privileges for
GitLab backup commands or protected config paths.

## Configuration

| Option | Default | Description |
| --- | --- | --- |
| `location` | `gitlab://local` | GitLab source or target URI. |
| `backup_path` | `/var/opt/gitlab/backups` | Directory containing GitLab backup archives. |
| `config_paths` | `/etc/gitlab/gitlab.rb,/etc/gitlab/gitlab-secrets.json` | Comma-separated config files to include during backup. |
| `config_dir` | `/etc/gitlab` | Config restore directory. |
| `gitlab_backup_bin` | `gitlab-backup` | Backup CLI binary name or path. |
| `use_sudo` | `false` | Prefix privileged operations with `sudo -n`. |
| `ssh_host` | unset | Remote host. When set, the integration runs through SSH. |
| `ssh_user` | unset | SSH username. |
| `ssh_port` | unset | SSH port. |
| `ssh_identity_file` | unset | SSH private key path. |
| `ssh_bin` | `ssh` | SSH binary name or path. |
| `force` | `false` | Exporter only: pass `force=yes` to `gitlab-backup restore`. |

## Examples

Back up a local GitLab instance:

```sh
plakar backup gitlab://local use_sudo=true
```

Back up a remote GitLab instance over SSH:

```sh
plakar backup gitlab://gitlab.example.com \
ssh_host=gitlab.example.com \
ssh_user=git \
use_sudo=true
```

Restore to a local GitLab instance:

```sh
plakar restore -to gitlab://local use_sudo=true <snapshot-id>
```

Restore to a remote GitLab host:

```sh
plakar restore -to gitlab://gitlab.example.com \
ssh_host=gitlab.example.com \
ssh_user=git \
use_sudo=true \
<snapshot-id>
```

## Restore Notes

GitLab restore has operational prerequisites outside Plakar, including stopping
services that write to the database before running restore and running GitLab's
post-restore checks afterward. Follow the GitLab backup and restore
documentation for the target version.
Loading