Skip to content

Commit f75f7a2

Browse files
authored
content: add GitLab and RustFS integration guide (#78)
1 parent 5ba3849 commit f75f7a2

6 files changed

Lines changed: 283 additions & 0 deletions

File tree

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
---
2+
title: "GitLab and RustFS Integration: OIDC SSO and S3 Object Storage"
3+
slug: gitlab-rustfs-integration
4+
description: "Integrate GitLab with RustFS for OIDC single sign-on and S3-compatible object storage for CI/CD artifacts, LFS, packages, and uploads."
5+
date: '2026-08-04T00:00:00.000Z'
6+
author: RustFS Team
7+
tags:
8+
- Integration
9+
image: /images/blog/gitlab-rustfs-integration/cover.png
10+
---
11+
12+
GitLab and RustFS can form a fully self-hosted platform for source control, CI/CD, identity, and scalable object storage. A **GitLab RustFS integration** gives teams two practical capabilities: employees can sign in to the RustFS Console with their GitLab accounts, and GitLab can store artifacts and other large objects in RustFS instead of on local disk.
13+
14+
This guide walks through both configurations:
15+
16+
1. Use GitLab as an OpenID Connect (OIDC) identity provider for RustFS single sign-on.
17+
2. Use RustFS as an S3-compatible object storage backend for GitLab CI/CD artifacts.
18+
19+
The same object storage pattern can also support Git LFS objects, uploads, packages, Terraform state, Pages, secure files, external merge request diffs, and the dependency proxy.
20+
21+
> The examples use `gitlab.example.com` and `rustfs.example.com`. Replace these hostnames with your own domains. HTTP is acceptable for an isolated test environment, but production deployments should use HTTPS.
22+
23+
## Why integrate GitLab with RustFS?
24+
25+
GitLab is a comprehensive DevSecOps platform that can be deployed in a private environment. RustFS is an open-source, high-performance, S3-compatible object storage system that can also run entirely on your own infrastructure.
26+
27+
Connecting the two platforms provides several benefits:
28+
29+
- **Centralized identity:** GitLab OIDC lets users access RustFS with an existing company account.
30+
- **Scalable CI/CD storage:** Build artifacts can move from a GitLab server's local disk to dedicated object storage.
31+
- **S3 compatibility:** GitLab can connect to RustFS through its standard S3 object storage configuration.
32+
- **Data control:** Source code, credentials, metadata, and build outputs remain inside infrastructure you manage.
33+
- **Independent scaling:** GitLab compute resources and RustFS storage capacity can scale separately.
34+
35+
## Part 1: Configure GitLab OIDC single sign-on for RustFS
36+
37+
With OIDC enabled, GitLab authenticates users while RustFS controls what those users are allowed to do. The login flow uses the GitLab application ID and secret to establish trust between the two services.
38+
39+
### Prerequisites
40+
41+
Before starting, make sure you have:
42+
43+
- A running GitLab instance and access to its **Admin Area**.
44+
- A running RustFS instance and permission to edit its service environment.
45+
- DNS records for both services.
46+
- TLS certificates for production endpoints.
47+
- A RustFS IAM policy appropriate for GitLab users.
48+
49+
### Install RustFS
50+
51+
RustFS supports binary, Docker, and Kubernetes deployments. On Ubuntu 22.04, you can use the installation script for a quick test deployment:
52+
53+
```bash
54+
curl -O https://rustfs.com/install_rustfs.sh
55+
bash install_rustfs.sh
56+
```
57+
58+
After installation, edit `/etc/default/rustfs` and replace the default values of `RUSTFS_ACCESS_KEY` and `RUSTFS_SECRET_KEY`. Use strong, unique credentials and do not retain the default `rustfsadmin` value.
59+
60+
Restart RustFS after updating the configuration:
61+
62+
```bash
63+
sudo systemctl restart rustfs
64+
```
65+
66+
Open the RustFS Console at:
67+
68+
```text
69+
https://rustfs.example.com
70+
```
71+
72+
The OIDC callback URL for the default provider is:
73+
74+
```text
75+
https://rustfs.example.com/rustfs/admin/v3/oidc/callback/default
76+
```
77+
78+
Keep this URL available. GitLab requires an exact match when you create the OAuth application.
79+
80+
### Create a GitLab OAuth application
81+
82+
You can use GitLab Community Edition, Enterprise Edition, or another compatible self-managed distribution. If GitLab is not yet installed, follow the [official GitLab installation documentation](https://docs.gitlab.com/install/).
83+
84+
To create the application:
85+
86+
1. Sign in to GitLab as an administrator.
87+
2. Open **Admin Area**.
88+
3. Select **Applications**, then select **New application** or **Add new application**.
89+
4. Enter a descriptive name such as `RustFS OIDC`.
90+
5. Set **Redirect URI** to:
91+
92+
```text
93+
https://rustfs.example.com/rustfs/admin/v3/oidc/callback/default
94+
```
95+
96+
6. Enable the `openid`, `profile`, and `email` scopes.
97+
7. Save the application.
98+
8. Copy the generated **Application ID** and **Secret** to a secure location.
99+
100+
![GitLab OAuth application configuration for RustFS OIDC](/images/blog/gitlab-rustfs-integration/gitlab-application-configuration.png)
101+
102+
The application secret is sensitive. Store it in a secret manager or another protected configuration system rather than in source control.
103+
104+
### Configure GitLab OIDC in RustFS
105+
106+
Edit `/etc/default/rustfs` and add the following environment variables:
107+
108+
```ini
109+
RUSTFS_BROWSER_REDIRECT_URL="https://rustfs.example.com"
110+
111+
RUSTFS_IDENTITY_OPENID_ENABLE=on
112+
RUSTFS_IDENTITY_OPENID_CONFIG_URL="https://gitlab.example.com"
113+
RUSTFS_IDENTITY_OPENID_CLIENT_ID="<gitlab-application-id>"
114+
RUSTFS_IDENTITY_OPENID_CLIENT_SECRET="<gitlab-application-secret>"
115+
RUSTFS_IDENTITY_OPENID_SCOPES="openid,profile,email"
116+
RUSTFS_IDENTITY_OPENID_REDIRECT_URI="https://rustfs.example.com/rustfs/admin/v3/oidc/callback/default"
117+
RUSTFS_IDENTITY_OPENID_REDIRECT_URI_DYNAMIC=off
118+
RUSTFS_IDENTITY_OPENID_DISPLAY_NAME="GitLab"
119+
RUSTFS_IDENTITY_OPENID_EMAIL_CLAIM="email"
120+
RUSTFS_IDENTITY_OPENID_USERNAME_CLAIM="preferred_username"
121+
RUSTFS_IDENTITY_OPENID_ROLE_POLICY="consoleAdmin"
122+
```
123+
124+
Replace `<gitlab-application-id>` and `<gitlab-application-secret>` with the credentials created in GitLab.
125+
126+
The example assigns the `consoleAdmin` policy to users who authenticate through this provider. For production, follow the principle of least privilege and replace it with a policy that grants only the required permissions.
127+
128+
Restart the service:
129+
130+
```bash
131+
sudo systemctl restart rustfs
132+
```
133+
134+
### Verify the OIDC login flow
135+
136+
Open the RustFS Console. The login page should now display **Login with GitLab**.
137+
138+
![RustFS Console showing the Login with GitLab option](/images/blog/gitlab-rustfs-integration/rustfs-console-gitlab-oidc.png)
139+
140+
Select the button and verify that:
141+
142+
1. The browser redirects to GitLab.
143+
2. GitLab authenticates the user.
144+
3. GitLab redirects the browser to the RustFS callback URL.
145+
4. The RustFS Console opens with the policy configured in `RUSTFS_IDENTITY_OPENID_ROLE_POLICY`.
146+
147+
If GitLab reports a redirect URI mismatch, compare the GitLab application URI and `RUSTFS_IDENTITY_OPENID_REDIRECT_URI` character by character. The scheme, hostname, port, path, and trailing slash behavior must match.
148+
149+
## Part 2: Use RustFS as GitLab object storage
150+
151+
GitLab can store several data types in an S3-compatible service, including:
152+
153+
- CI/CD artifacts
154+
- Git LFS objects
155+
- User uploads
156+
- Package registry data
157+
- Terraform state
158+
- GitLab Pages content
159+
- CI/CD secure files
160+
- External merge request diffs
161+
- Dependency proxy objects
162+
163+
Because RustFS implements the S3 API, GitLab can connect to it by using the AWS provider with a custom endpoint and path-style requests.
164+
165+
### Create a RustFS bucket
166+
167+
Create a dedicated bucket for each GitLab data type that you plan to move to object storage. For this example, create a bucket named `artifacts`.
168+
169+
You can create the bucket in the RustFS Console or with a compatible client. See the [RustFS bucket creation documentation](https://docs.rustfs.com/administration/data/bucket/creation) for detailed instructions.
170+
171+
![Creating the artifacts bucket in the RustFS Console](/images/blog/gitlab-rustfs-integration/rustfs-bucket-creation.png)
172+
173+
For production environments:
174+
175+
- Use a dedicated RustFS access key for GitLab.
176+
- Grant that identity access only to the required buckets.
177+
- Enable TLS for the RustFS S3 endpoint.
178+
- Apply lifecycle and retention rules based on your CI/CD requirements.
179+
- Monitor capacity, request errors, and object growth.
180+
181+
### Configure GitLab CI/CD artifacts storage
182+
183+
On an Omnibus GitLab installation, edit `/etc/gitlab/gitlab.rb` and add the following configuration:
184+
185+
```ruby
186+
gitlab_rails['artifacts_enabled'] = true
187+
gitlab_rails['artifacts_object_store_enabled'] = true
188+
gitlab_rails['artifacts_object_store_proxy_download'] = false
189+
gitlab_rails['artifacts_object_store_remote_directory'] = 'artifacts'
190+
gitlab_rails['artifacts_object_store_connection'] = {
191+
'provider' => 'AWS',
192+
'region' => 'us-east-1',
193+
'aws_access_key_id' => 'RUSTFS_ACCESS_KEY',
194+
'aws_secret_access_key' => 'RUSTFS_SECRET_KEY',
195+
'endpoint' => 'https://rustfs.example.com',
196+
'path_style' => true,
197+
'aws_signature_version' => 4
198+
}
199+
```
200+
201+
Replace the endpoint and credentials with values from your RustFS deployment. If the S3 API uses a dedicated port, include it in the endpoint, for example `https://rustfs.example.com:9000`.
202+
203+
Apply the GitLab configuration:
204+
205+
```bash
206+
sudo gitlab-ctl reconfigure
207+
```
208+
209+
### Test artifact uploads from a GitLab pipeline
210+
211+
Create or update `.gitlab-ci.yml` in a test project:
212+
213+
```yaml
214+
stages:
215+
- build
216+
217+
build:
218+
stage: build
219+
script:
220+
- mkdir -p output
221+
- echo "RustFS object storage test from GitLab" > output/rustfs.txt
222+
- ls -ltr output
223+
tags:
224+
- rustfs
225+
artifacts:
226+
paths:
227+
- output/*.txt
228+
expire_in: 1 week
229+
```
230+
231+
Run the pipeline and wait for the job to complete. Then open the `artifacts` bucket in the RustFS Console.
232+
233+
![GitLab CI/CD artifacts stored in a RustFS bucket](/images/blog/gitlab-rustfs-integration/gitlab-artifacts-check.png)
234+
235+
If objects appear in the bucket, GitLab is successfully storing CI/CD artifacts in RustFS instead of on the GitLab server's local disk.
236+
237+
### Configure other GitLab data types
238+
239+
GitLab uses similar object storage settings for LFS, uploads, packages, Terraform state, Pages, secure files, external diffs, and the dependency proxy. Use a separate bucket name for each data type and apply a narrowly scoped RustFS policy.
240+
241+
Before migrating production data, review the current [GitLab object storage documentation](https://docs.gitlab.com/administration/object_storage/) for settings specific to your GitLab version.
242+
243+
## Troubleshooting GitLab and RustFS integration
244+
245+
### OIDC login button does not appear
246+
247+
Confirm that `RUSTFS_IDENTITY_OPENID_ENABLE` is set to `on`, the GitLab configuration URL is reachable from the RustFS host, and RustFS was restarted after the environment file changed.
248+
249+
### GitLab reports a redirect URI mismatch
250+
251+
The redirect URI registered in GitLab must exactly match `RUSTFS_IDENTITY_OPENID_REDIRECT_URI`. Pay particular attention to HTTP versus HTTPS, ports, and trailing slashes.
252+
253+
### GitLab cannot upload artifacts
254+
255+
Check the RustFS endpoint, access key, secret key, bucket name, and network connectivity. Keep `path_style` enabled for the configuration shown in this guide, and confirm that the GitLab identity can read and write objects in the `artifacts` bucket.
256+
257+
### Artifacts remain on local disk
258+
259+
Run `sudo gitlab-ctl reconfigure`, inspect GitLab logs for object storage errors, and verify that the pipeline produced an artifact. Existing local artifacts are not necessarily migrated automatically when object storage is enabled.
260+
261+
## Frequently asked questions
262+
263+
### Is RustFS compatible with GitLab object storage?
264+
265+
Yes. RustFS provides an S3-compatible API, and GitLab supports S3-compatible object storage through its AWS provider configuration and a custom endpoint.
266+
267+
### Can GitLab authenticate RustFS users?
268+
269+
Yes. GitLab can act as an OIDC identity provider. Users sign in through GitLab, while RustFS maps the authenticated identity to a local IAM policy.
270+
271+
### Can RustFS store more than GitLab CI/CD artifacts?
272+
273+
Yes. GitLab can use object storage for artifacts, LFS objects, uploads, packages, Terraform state, Pages, secure files, external diffs, and dependency proxy data.
274+
275+
### Should GitLab and RustFS use HTTPS?
276+
277+
Yes. Production deployments should use HTTPS for both the GitLab OIDC endpoints and the RustFS Console and S3 API. TLS protects credentials, tokens, and application data in transit.
278+
279+
## Conclusion
280+
281+
Integrating GitLab with RustFS creates a self-hosted workflow with centralized authentication and scalable S3-compatible storage. OIDC reduces the need for separate RustFS Console credentials, while object storage prevents CI/CD artifacts and other large files from consuming GitLab's local disk.
282+
283+
Start with a test bucket and a limited IAM policy, validate the complete login and upload flows, and then expand the configuration to additional GitLab data types as your storage requirements grow.
1.61 MB
Loading
577 KB
Loading
177 KB
Loading
418 KB
Loading
232 KB
Loading

0 commit comments

Comments
 (0)