Logo

    Home

    Documentation

    Use Cases

    Training

    Applications

    Release Notes

    Application Deployment via Portainer

    Application Deployment via Portainer

    • Description
    • Overview
    • Key Features
    • How to use it
    • 1. Deploy a stack
    • 2. Updating the Stack
    • 3. Check the logs of your container
    • 4. Clean up old images from server

    Description

    Portainer is a powerful container management tool that simplifies the deployment and management of containerised applications within Docker environments. A deployment with Portainer involves utilising the Portainer platform to streamline the process of creating, managing, and monitoring Docker containers and services.

    Here's a detailed description of a deployment with Portainer

    Overview

    Portainer acts as a user-friendly interface for Docker, providing a graphical representation of Docker containers, images, networks, and volumes. It enables users, regardless of their level of expertise with Docker, to manage and interact with containerised applications efficiently.

    Key Features

    1. User Interface (UI) Portainer offers an intuitive web-based UI that makes it easy for users to navigate and interact with Docker components. The UI presents a visual representation of containers, making it simple to monitor their status and manage configurations.
    2. Container Deployment Users can deploy containers directly through Portainer. This involves specifying the image to use, defining environment variables, configuring network settings, and allocating resources. Portainer simplifies this process, reducing the complexity of Docker commands.
    3. Application Templates Portainer provides a range of application templates, allowing users to deploy common applications with predefined settings. This feature simplifies the deployment of popular services like databases, web servers, and content management systems.
    4. Resource Management Users can monitor and manage resource usage (CPU, memory, storage) of containers through the Portainer interface. This ensures optimal performance and resource allocation for running applications.
    5. User Access Control Portainer supports user authentication and access control, allowing organisations to define roles and permissions for different users. This enhances security by restricting access to sensitive operations and configurations.
    6. Volume and Network Management Portainer facilitates the creation and management of Docker volumes and networks. Users can configure data storage for containers and define network connections, ensuring seamless communication between containers.
    7. Health Checks and Logging Portainer provides health check indicators for containers, helping users identify and address issues promptly. It also offers logs and event tracking, aiding in troubleshooting and monitoring container activities.

    How to use it

    1. Deploy a stack

    1. Login to B1 Portainer URL
    2. You will see an overview with all environments.
    3. Select the server you want to deploy to
    4. Select “Add stack”
    5. Give it a name like myapp,
    6. icon
      The standard suggestion is to name it just like your git repository
    7. Select “Web editor” (should be selected by default)
    8. Navigate to Bitbucket of your app and copy the full content of the file at the following path .deploy/portainer.deployment.docker-compose.yml
    9. Paste back in the Web Editor in Portainer
    10. Move on to next step (Do not deploy yet!)
    11. Webhooks: false
    12. Add the environment variables by pressing “Add an environment variable”
      1. Sample application, match the casing for the names as those are read into the configuration as variables
        1. STACK (this will be your sub sub domain)
          1. Name: STACK
          2. Value <your application name>
        2. VERSION
          1. Name: VERSION
          2. VALUE <version tag or branch your application is based on> i.e. develop
          3. icon
            Portainer will give you feedback with an deployment error, if you used a non-existent version number. It always depends on the images that are published to cloudsmith. I.e. develop is not built and published for swat, but for offer
        3. DOMAIN
          1. Name: DOMAIN
          2. VALUE domain.de
        4. DEFAULT_APP
          1. Name: DEFAULT_APP
          2. Value: <name of your app in B1>
      2. If you want to connect an existing Security-HubSecurity-Hub
        1. AUTHENTICATION_OIDC_ROLE_ID
          1. Name: AUTHENTICATION_OIDC_ROLE_ID
          2. Value: <Value form Sechub>
        2. AUTHENTICATION_AUDIENCE
          1. Name: AUTHENTICATION_AUDIENCE
          2. Value: <Value form Sechub>
    13. Enable access control and set access control to restricted and not private and select all teams.
    14. Deploy the stack
    15. Give it 2 to 5 min to start properly - test to open your new environment at https://<STACK>.<DOMAIN>

    2. Updating the Stack

    1. Open an existing stack
    2. 🚨 update the editor the latest config from your repo by:
      • looking for .deploy/portainer.deployment.docker-compose.yml in your repo
      • compare it with the stack editor
      • Update to latest values and additions, without removing customisations
    3. Update the stack, find under the environment variables the option to Update the stack.
    4. image
      image

    3. Check the logs of your container

    icon
    Please be careful with the following information, if you use it wrong errors/problems can happen!
    1. Open Portainer
      1. Choose your environment
      2. Choose your stack
    2. Look for the pasoe container (1) and click on icon “Console” (2)
    3. image
    4. Click on Connect
    5. Enter in console:
      1. cd /workspace/pasoe/logs Enter
      2. ls -la Enter
    6. Look for app.agent.[DATE].log
    7. Open the file
      1. for the last 100 lines: cat app.agent.[DATE].log
      2. Live reading: tail -f app.agent.[DATE].log
    8. Click disconnect

    4. Clean up old images from server

    1. Portainer will download each image on the local server and will not delete them automatically. This must be done manually
    2. Open Portainer
    3. Go to Images
    4. On the upper left of the grid you can filter the images, show only the unused ones
    5. Now you can select all and delete them

    Back to DocumentationDocumentation

    Back to Home Page

    Logo