Seenode Documentation
DocsTutorialsSign in
  • Docs
  • Quickstart
    • Deploy a FastAPI app
  • API
    • Getting an API token
  • Deploying
    • Build & Start command
    • Root directory configuration
    • Port configuration
    • Deploying using GitHub actions
    • Deploying using GitLab CI/CD
    • Install Node to Python image
Powered by GitBook
On this page
  • Prerequisites
  • Step 1: Store sensitive data in GitLab CI/CD variables
  • Step 2: Create the GitLab CI/CD Pipeline
  • Step 3: Commit and Push the Pipeline Configuration
  • Step 4: Verify the Pipeline Execution
  • Troubleshooting
  • Conclusion
  1. Deploying

Deploying using GitLab CI/CD

This guide explains how to set up a GitLab CI/CD pipeline that automatically triggers a deployment to seenode whenever a commit is pushed to a specified branch.

PreviousDeploying using GitHub actionsNextInstall Node to Python image

Last updated 1 month ago

Prerequisites

  1. A GitLab repository where you want to set up the CI/CD pipeline.

  2. An Existing seenode application you want to deploy.

  3. An API token for the seenode API. 👉

  4. Permissions to create GitLab CI/CD variables and modify .gitlab-ci.yml.

Step 1: Store sensitive data in GitLab CI/CD variables

To keep your credentials secure, store them as GitLab CI/CD variables:

  1. Go to your GitLab repository.

  2. Navigate to Settings → CI/CD → Variables.

  3. Click Add Variable and add the following variables:

    • SEENODE_APPLICATION_ID → Your seenode application ID.

    • SEENODE_API_TOKEN → Your API authentication token.

Step 2: Create the GitLab CI/CD Pipeline

  1. In the root of your repository, create or edit the .gitlab-ci.yml file.

  2. Add the following content:

stages:
  - deploy

deploy_to_seennode:
  stage: deploy
  only:
    - main  # Change this if needed
  script:
    - |
      curl -X POST "https://api.seenode.com/v1/applications/$SEENODE_APPLICATION_ID/deployments-new" \
        -H "Authorization: Bearer $SEENODE_API_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
              "gitCommitSha": "'$CI_COMMIT_SHA'"
            }'

Step 3: Commit and Push the Pipeline Configuration

  1. Save the .gitlab-ci.yml file.

  2. Commit and push it to your repository:

    git add .gitlab-ci.yml
    git commit -m "Add GitLab CI/CD pipeline for seenode deployment"
    git push origin main

    (Replace main with your branch name if different.)

Step 4: Verify the Pipeline Execution

  1. Go to your GitLab repository.

  2. Click on CI/CD → Pipelines.

  3. Locate the latest pipeline run and verify that it executed successfully.

  4. If there is an issue, click on the failed job to check the logs for debugging.

Troubleshooting

  • Pipeline is not triggering?

    • Ensure you are pushing to the correct branch (main by default in the pipeline).

    • Check if CI/CD is enabled in your repository settings.

  • Authentication error?

    • Verify that the API token is correct and not expired.

    • Ensure that SEENODE_API_TOKEN is set as a GitLab CI/CD Variable.

  • Incorrect API endpoint?

    • Double-check the application ID and the API URL format.

Conclusion

You have now successfully set up a GitLab CI/CD pipeline to automatically deploy to seenode when changes are pushed to the repository. This automation ensures that your deployments stay consistent and efficient.

Find application ID in the browser URL: ) ⇒ application ID is 969217

Generate API token here
Getting an API token
https://cloud.seenode.com/dashboard/applications?applicationId=969217#logs