Building Your App
Welcome to the SmoothGlue platform! This guide will help you set up your application, configure your CI/CD pipeline, and follow best practices for project structuring.
Project Setup
Create a Project in GitLab
To begin, you'll need to create a project in GitLab. Follow these steps:
- Log in to GitLab: Access your GitLab account through the SmoothGlue Console.
- Create a New Project: Navigate to the "Projects" section and click "New Project".
- Follow the prompts to set up your project.
If you need more information, consult the GitLab Project Creation
Setup CI Pipeline
Once your project is created, it's time to set up your CI/CD pipeline. You can build one yourself, but we recommend using the SmoothGlue Pipeline which handles a lot of the hard work for you. If you want to deploy to SmoothGlue Cloud Run clusters, you'll have to run this pipeline. But if you have your own runtime environment, or are using SmoothGlue Enterprise, you can run whatever GitLab CI pipeline you like.
Please refer to Include the Pipeline Configuration for details on how to setup your pipeline.
Additional Configuration
Set Up MR Rules and Default Branch in GitLab
Enhance your project's workflow by setting up Merge Request (MR) rules and selecting a default branch:
Merge Request Rules:
- Navigate to Settings > CI/CD.
- Under Merge request (MR) rules, click Expand.
- Define the following MR rules to ensure code quality and collaboration:
- Only allow merging if the pipeline succeeds.
- Require a minimum of one approving review from maintainers or members with the "developer" role.
- Set a custom message for merge requests, such as "Please include relevant information about your changes."
Default Branch:
- Choose a default branch for your project, typically
main
. This is where your application's code will be hosted and can be changed in Settings > Repository. - Create an integration branch if you plan to deploy (typically
develop
) which will get deployed to your pre-prod environment.
Developer Setup
Set up Personal Access Tokens
SmoothGlue uses a service mesh for routing traffic, which provides many security and observability benefits. Additionally we enforce Two-Factor Authentication (2FA) in our authentication. As a result, you'll need to set up a Personal Access Token to be able to push and pull code via HTTPS, as SSH authentication is not typically enabled.
- Log in to your GitLab account
- Navigate to Settings > Access Tokens
- Enter a name for the token, such as "SmoothGlue Workstation"
- Choose the desired expiration date
- Select the appropriate scopes for the token (e.g.,
read_repository
,write_repository
, andapi
) - Click Create personal access token
- Copy the token value and save it securely. You will not be able to view or retrieve the token again once you leave this page.
Once you have created a Personal Access Token, when you clone your repository, enter that when prompted for a password.
Branching Workflow
- Main (or master) branch: The primary branch for production code. All pull requests should be merged into this branch only after thorough testing and review.
- Development (or develop) branch: A branch where new features and changes are developed and integrated before being merged into the main branch. This branch is typically used for pre-production testing and QA.
- Feature branches: Branches created from the development branch to work on specific features or bug fixes. These branches should be short-lived, focused, and merged back into the development branch as soon as possible.
- Release branches: Temporary branches created from the development branch to prepare for a new release. These branches undergo additional testing and QA before being merged back into the main branch.
- Hotfix branches: Branches created from the main branch to address critical issues in production code. These branches should be short-lived, focused, and merged back into both the main and development branches as soon as possible.
In this strategy, the CI pipeline is more lenient on feature, release, and hotfix branches, allowing for faster iteration and experimentation. However, the pipeline becomes much more strict when a merge request passes and runs on the default branch (typically main
), ensuring that only high-quality code makes it to production.
Supported Languages and Build Frameworks
SmoothGlue supports a variety of languages and build frameworks, with more added frequently. The pipeline will discover your language and build your code based on what it finds, but there are some standards we expect you to follow in how your project is structured. We'll get more into this later.