GitLab Self-Hosted
Comprehensive guide for connecting Factory with your self-hosted GitLab instance
This guide provides detailed instructions for integrating Factory with your self-hosted GitLab instance, allowing Factory’s Droids to securely access and work with your on-premise repositories.
Prerequisites
- Admin access to your self-hosted GitLab instance
- Network access between your GitLab instance and Factory’s AWS VPC
- A Factory account with admin privileges
Integration Process
Initial Setup & Information Gathering
Create GitLab Application
- In your GitLab instance, go to Admin Area > Applications.
- Click “New application” and fill in the details:
- Name: “Factory Integration”
- Redirect URI: (Provided by Factory)
- Scopes: Select all necessary scopes (detailed in “Required Permissions” section)
- Save the application and note down the Application ID and Secret.
Collect Integration Information
Gather the following details:
- Application ID
- Application Secret
- Your GitLab instance URL
- A personal access token with admin rights
Submit Information to Factory
Securely send the collected information to your Factory representative.
Network Security Configuration
Evaluate Network Policy
Review your current network security policies to identify potential connectivity barriers with Factory’s AWS VPC.
Establish Connectivity
Choose one of the following methods:
- VPC Peering (if your GitLab is on AWS):
- Initiate a VPC peering request.
- Exchange VPC IDs with Factory.
- Configure route tables for direct network routes.
- VPN Connection:
- Establish a VPN between your network and Factory’s.
- Ensure VPN settings (e.g., IPsec) are compatible on both ends.
Firewall Configuration
- Allow outbound connections to Factory’s services (HTTPS and SSH traffic).
- Ensure your GitLab instance can communicate with Factory’s webhook endpoint.
Webhook Setup
Create Webhook
In your GitLab instance settings, create a new webhook:
- URL: (Provided by Factory)
- Secret Token: (Provided by Factory)
- Trigger on: Pushes, Comments, Merge Requests, Issues, CI/CD events
Test Webhook
Use GitLab’s “Test” feature to ensure the webhook is properly configured.
Required Permissions
Ensure the GitLab application has the following scopes:
api
(Full API access)read_user
(Read user information)read_repository
(Read repository information)write_repository
(Write to repositories)read_registry
(Read container registry)sudo
(Perform API actions as any user)
Testing and Validation
Preliminary Testing
Work with Factory to conduct initial tests of API connectivity and webhook functionality.
Comprehensive Testing
Test all GitLab events that trigger Droids within Factory, including:
- Creating merge requests
- Pushing code
- Opening issues
- Running CI/CD pipelines
Validation
Verify that Factory Droids respond correctly to these events.
Final Adjustments and Go-Live
Feedback and Adjustments
Provide feedback on any issues encountered during testing. Work with Factory to make necessary adjustments.
Go-Live
Agree on a go-live date with Factory.
Monitoring
Implement continuous monitoring for the initial days post-launch to quickly address any unforeseen issues.
Troubleshooting
- If API calls fail, check your network configuration and firewall rules.
- For permission-related issues, review the application settings and scopes in your GitLab instance.
- If webhooks aren’t being received, verify the webhook URL and secret token.
Support
For any specific issues or detailed support needs, contact the Factory team through your designated support channel.
Security and Compliance
Learn about Factory’s security measures for enterprise integrations