<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mor</title>
    <description>The latest articles on DEV Community by Mor (@mormor83).</description>
    <link>https://dev.to/mormor83</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F640895%2Fa0abe102-6bed-4458-8e58-f890166e51af.jpeg</url>
      <title>DEV Community: Mor</title>
      <link>https://dev.to/mormor83</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mormor83"/>
    <language>en</language>
    <item>
      <title>Efficient Offboarding of Users in GitLab</title>
      <dc:creator>Mor</dc:creator>
      <pubDate>Sun, 08 Sep 2024 18:15:13 +0000</pubDate>
      <link>https://dev.to/mormor83/efficient-offboarding-of-users-in-gitlab-m66</link>
      <guid>https://dev.to/mormor83/efficient-offboarding-of-users-in-gitlab-m66</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When people leave an organization, it can be challenging both operationally and personally. Their absence is felt, and navigating these transitions requires both sensitivity and a solid strategy to keep things on track.&lt;/p&gt;

&lt;p&gt;Offboarding users from GitLab is a crucial step to ensure security and continuity within an organization. It's important to handle this process carefully to protect sensitive information while keeping operations running smoothly. This article explores the challenges of offboarding and outlines an effective approach to manage it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Considerations in GitLab User Offboarding
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. User Tokens
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Personal Access Tokens (PATs) are revoked when a user is blocked&lt;/li&gt;
&lt;li&gt;Potential issues if PATs are used in critical systems or workflows&lt;/li&gt;
&lt;li&gt;Need to identify and address dependencies on personal tokens before offboarding&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Scheduled Pipelines
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Scheduled Pipelines (SP) are bound to individual users&lt;/li&gt;
&lt;li&gt;Blocking a user disables their associated Scheduled Pipelines&lt;/li&gt;
&lt;li&gt;Requires ownership transfer to an active user to maintain pipeline functionality&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Automated Offboarding Process
&lt;/h2&gt;

&lt;p&gt;To address these challenges, we've implemented an automated offboarding process that includes safety checks and escalation procedures. Here's an overview of the process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Initiation&lt;/strong&gt;: IT department triggers the offboarding process via an API call to a Lambda function.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Initial Validation&lt;/strong&gt;: The Lambda function performs basic checks, such as verifying the user's email domain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jenkins Job Activation&lt;/strong&gt;: A Jenkins job is triggered to perform more detailed checks:
a. Check for active tokens used within the last 14 days
b. Identify any Scheduled Pipelines associated with the user&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decision Making&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;If any checks return true (active tokens or SPs exist), a Jira support ticket is created for the DevOps team.&lt;/li&gt;
&lt;li&gt;The DevOps team collaborates with the user's manager to address any potential issues.&lt;/li&gt;
&lt;li&gt;If no issues are found, the process proceeds to block the user.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Blocking&lt;/strong&gt;: An API call is made to GitLab to block the user if all checks pass.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Visual Representation of the Offboarding Process
&lt;/h2&gt;

&lt;p&gt;The following flowchart illustrates the step-by-step process of our automated GitLab user offboarding system:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwngdihsefvgqf0qj6li7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwngdihsefvgqf0qj6li7.jpg" alt="Image description" width="556" height="1715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This diagram outlines the key decision points and actions taken during the offboarding process, from initial triggering by IT to the final blocking of the user in GitLab. It highlights the automated checks, escalation procedures, and the role of the DevOps team in resolving any issues that arise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jenkins Process Flowchart
&lt;/h2&gt;

&lt;p&gt;To better visualize the workflow implemented in our Jenkins file, we've created the following flowchart. This diagram illustrates the main steps of the GitLab user offboarding process, including user verification, checks for scheduled pipelines and tokens, and the decision-making process for either creating a Jira ticket or blocking the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f5nouabiyd2wed46gax.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3f5nouabiyd2wed46gax.jpg" alt="Image description" width="800" height="584"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of This Approach
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Risk Mitigation&lt;/strong&gt;: Prevents accidental disruption of critical systems relying on personal tokens or scheduled pipelines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated Checks&lt;/strong&gt;: Reduces manual effort and the likelihood of human error in the offboarding process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Escalation Procedure&lt;/strong&gt;: Ensures that potential issues are reviewed by appropriate stakeholders before taking action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance&lt;/strong&gt;: Helps maintain security by ensuring timely offboarding while considering operational dependencies.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Best Practices for Preventing Token and Pipeline Issues
&lt;/h2&gt;

&lt;p&gt;To minimize complications during the offboarding process, consider implementing these best practices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Regular Token Audits&lt;/strong&gt;: Conduct periodic reviews of active tokens and their usage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token Expiration Policies&lt;/strong&gt;: Enforce short-lived tokens with automatic expiration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared Service Accounts&lt;/strong&gt;: Use dedicated service accounts for critical systems instead of personal accounts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pipeline Ownership Documentation&lt;/strong&gt;: Maintain a centralized registry of Scheduled Pipeline ownership.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated Pipeline Transfers&lt;/strong&gt;: Implement a process to automatically transfer pipeline ownership during offboarding.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Case Study: Improved Offboarding Efficiency
&lt;/h2&gt;

&lt;p&gt;After implementing this automated offboarding process, our organization observed the following improvements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;80% reduction in time spent on manual offboarding tasks&lt;/li&gt;
&lt;li&gt;95% decrease in incidents related to unintended service disruptions during offboarding&lt;/li&gt;
&lt;li&gt;100% compliance with security policies for timely access revocation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;To further enhance the offboarding process, consider these potential improvements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Self-Service Portal&lt;/strong&gt;: Develop a user interface for managers to initiate and track the offboarding process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration with HR Systems&lt;/strong&gt;: Automate the trigger of the offboarding process based on HR events.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collect the data from GitLab DB&lt;/strong&gt;: In our setup, accessing the GitLab DB would be a slightly complicated task and an unwanted overhead for the application. We compromised using the above Python code with a runtime of ~30 min that is acceptable at this time. In different architectures of GitLab (not omnibus), accessing the DB and querying the user info will be much easier and more accessible.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Efficient offboarding of users in GitLab requires a balanced approach that addresses security concerns while maintaining operational continuity. By implementing an automated process with built-in safety checks and escalation procedures, organizations can streamline their offboarding workflow, reduce risks, and ensure a smooth transition when users leave the system. Regular reviews and continuous improvement of the offboarding process will help organizations stay ahead of potential issues and maintain a secure and efficient GitLab environment.&lt;/p&gt;

</description>
      <category>gitlab</category>
      <category>devops</category>
      <category>jenkins</category>
    </item>
    <item>
      <title>Backup Grafana Dashboards using Azure DevOps</title>
      <dc:creator>Mor</dc:creator>
      <pubDate>Sun, 27 Jun 2021 06:40:02 +0000</pubDate>
      <link>https://dev.to/mormor83/backup-grafana-dashboards-using-azure-devops-3m0</link>
      <guid>https://dev.to/mormor83/backup-grafana-dashboards-using-azure-devops-3m0</guid>
      <description>&lt;p&gt;DevOps is a set of practices that combines software development (Dev) and IT operations (Ops). It aims to shorten the systems development life cycle and provide continuous delivery with high software quality. DevOps is complementary with Agile software development; several DevOps aspects came from the Agile methodology.&lt;/p&gt;

&lt;p&gt;Helping to support such a vast operation we as DevOps teams use multiple 3rd party application that need constant monitoring. &lt;br&gt;
One of those tools is Grafana. A great application for better observability across multi-data centers.&lt;br&gt;
Using Grafana we are able to keep track on data coming from MSSQL ElasticSearch , Prometheus , Coralogix , API and more.&lt;br&gt;
With such an extensive operation we need a way to back up all the dashboards we have per environment. &lt;br&gt;
This prove to be a bit tricky since :&lt;/p&gt;

&lt;p&gt;[X] How do we keep the same folder structures ?&lt;br&gt;
[X] How easy will it be to restore one or many dashboards ?&lt;br&gt;
[X] Will i have multiple backups per environment ?&lt;/p&gt;




&lt;h1&gt;
  
  
  What Do We Need To Backup
&lt;/h1&gt;

&lt;p&gt;A dashboard in Grafana is represented by a JSON object, which stores metadata of its dashboard. Dashboard metadata includes dashboard properties, metadata from panels, template variables, panel queries, etc.&lt;br&gt;
See an example dashboard for RabbitMQ:&lt;br&gt;
&lt;a href="https://github.com/rabbitmq/rabbitmq-prometheus/blob/master/docker/grafana/dashboards/RabbitMQ-Overview.json"&gt;RabbitMQ-Overview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see the dashboard only points to the data source and to the query type and content. &lt;br&gt;
So we now know that we need to backup just the JSON file of each dashboard stored in Grafana DB:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gUInqoC4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/un51fetzauyqwbjkh8xb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gUInqoC4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/un51fetzauyqwbjkh8xb.png" alt="grafana-high-availability"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Backup Options&lt;br&gt;
We explored a few option for backing up Grafana:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Server backup&lt;br&gt;
In case it's needed- we will need to create an new server and dump the image on it. This method is in effect by the SRE-IT department but the disadvantages oversees the good ones&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DB backup&lt;br&gt;
In case it's needed- We will need to spin up a new DB ( MySQL or PostgresSQL ) and do a restore. Usually will require some assistance from DBA/DataOps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dashboard backup&lt;br&gt;
This method , with it's challenges , proved to be a task that will require the DevOps team with no other dependency.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  DevOps Building Blocks
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Azure Repos
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;cloud-hosted private Git repos for your project&lt;br&gt;
Microsoft Azure provide free private Git repositories that we use to store our code as well as other projects.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Azure Pipelines
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Continuously build, test, and deploy to any platform and cloud&lt;br&gt;
Cloud-hosted pipelines for Linux, macOS, and Windows. Build web, desktop and mobile applications. Deploy to any cloud or on‑premises using installed agents per environment.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  Let's start backing up
&lt;/h1&gt;

&lt;p&gt;First we will lay the architecture more clearly :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KnhJndTm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bme9u6963ig2f7w6xx79.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KnhJndTm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bme9u6963ig2f7w6xx79.jpg" alt="architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Azure agents will have the option to access each environment and query the dedicated Grafana API and return the result back to Azure Pipelines.&lt;br&gt;
Those step will repeat each environment we would like to backup i.e QA/Sandbox/Staging/Production&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5E-45u58--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txanj4cikka2xg4wl10e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5E-45u58--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txanj4cikka2xg4wl10e.png" alt="pipeline"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;let's see a more detailed view of the flow in one of the above env:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NXpZQcj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ge544zfi7mdy0xvk6y7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NXpZQcj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ge544zfi7mdy0xvk6y7.jpg" alt="Grafana QA backup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The flow will backup each environment to it's own GIT branch resulting in the below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e6wZpG_m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wh7b7zym734fyqy5zt24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e6wZpG_m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wh7b7zym734fyqy5zt24.png" alt="each env"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Code
&lt;/h1&gt;

&lt;p&gt;The full code can be found here:&lt;br&gt;
&lt;a href="https://github.com/kfirlevin/grafana-dashboards-backup"&gt;https://github.com/kfirlevin/grafana-dashboards-backup&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;With very easy setup using Azure Devops Repos and Pipelines we were able to backup all of our environments on a daily basis using a simple Powershell code that iterate over our environment .&lt;/p&gt;

</description>
      <category>azuredevops</category>
    </item>
  </channel>
</rss>
