Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Gitlab: Own The Pipeline - Adrian Goins

DevOps-DF
November 08, 2017

Gitlab: Own The Pipeline - Adrian Goins

GitLab is, at its core, a tool for centrally managing Git repositories. As one might expect form a platform that provides this service, GitLab provides a robust authentication and authorization mechanism, groups, issue tracking, wiki, and snippets, along with public, internal, and private repositories.

Learn how to leverage Gitlab as the full stack solution for deploying apps, from code repo through build, to registry and automatic deployment.

DevOps-DF

November 08, 2017
Tweet

More Decks by DevOps-DF

Other Decks in Technology

Transcript

  1. © 2017 Rancher Labs, Inc . Who Am I? •

    Adrian Goins - Field Engineer for Rancher Labs • I am a 22-year veteran of system administration • Spent 14 years as owner and principal architect for Arces Network, an MSP that build and managed datacenters for MTV/Viacom, BET, Oxygen, Lifetime, Right Media, Scholastic, and other media companies • I have been a Docker user since 2013
  2. © 2017 Rancher Labs, Inc . What Do I Believe?

    • Any process that requires a human to do it will eventually fail. • If you can’t be replaced, you can’t be promoted. • We have an obligation to move toward simplicity to counteract the natural tendency to move toward complexity. • Automation is the key to survival.
  3. © 2017 Rancher Labs, Inc . What Is Gitlab? •

    Multi-user Git repository • CI/CD pipeline • Container Registry • Embedded Communication Platform (Mattermost)
  4. © 2017 Rancher Labs, Inc . A common deployment pipeline

    5 Develop Build Package Test Deploy/Upgrade Operate Docker Hub Code Repository CI Platform Container Registry
  5. © 2017 Rancher Labs, Inc . The simplified deployment pipeline

    6 Develop Build Package Test Deploy/Upgrade Operate Code Repository CI Platform Container Registry
  6. © 2017 Rancher Labs, Inc . Gitlab and Orchestration •

    Gitlab handles: • Source code control • Building containers • Storing containers in the registry • Testing and artifact storage • Deployment through external integrations • Your orchestrator handles: • Host management and container scheduling • The complete lifecycle of resources • Making containers available for consumers
  7. © 2017 Rancher Labs, Inc . Gitlab CI and Docker

    • Don’t compile the toolchain into the container • Bring the code up inside of a container that acts on the code • Move the code to the next build stage • Deploy the result
  8. © 2017 Rancher Labs, Inc . Best Practices • Never

    use ”latest” in deployments • Tag production images with a version number • Use branch names for development and feature branches
  9. © 2017 Rancher Labs, Inc . What Do We Get

    From This? • Reduce complexity • Bundle CI instructions and Dockerfile with codebase • Automate deployments • Provide an environment for testing • Make it easy so others will use it
  10. © 2017 Rancher Labs, Inc . Deploying Gitlab under Docker

    • Container images are made available by Gitlab • Alter the default config by using GITLAB_OMINBUS_CONFIG variable • Add SSL termination via a load balancer in front of the container • Set up basic configuration to protect the deployment
  11. © 2017 Rancher Labs, Inc . CI/CD Pipeline Demo •

    Prerequisites • Create Rancher environment • Add a host • Add Gitlab Registry • Deploy a stack named after group • Create environment-level API key and add to Gitlab • Manual Deployment • Use Gitlab CI to build the Docker image (tag: develop) • Deploy this manually on dev • Merge to master and tag • Use Gitlab CI to build the Docker image (tag: master/latest/v1.0)
  12. © 2017 Rancher Labs, Inc . CI/CD Pipeline Demo •

    Automation • Use Gitlab CI to build the Docker image (tag: develop) • Gitlab CI will then update the dev image in Rancher • This works with different branches as well • When we merge and tag, Gitlab CI also performs an update to the production service • We don’t have to use ”master” as our branch - our configuration will deploy any tagged branch
  13. © 2017 Rancher Labs, Inc . Resources • Rancher Gitlab

    Deploy • https://github.com/cdrx/rancher-gitlab-deploy • Demonstration Code • https://gitlab.com/monachus/rancher-meetup-nginx • GITLAB_OMNIBUS_CONFIG • https://gitlab.com/snippets/1665044