Installing and managing agent
    • PDF

    Installing and managing agent

    • PDF

    Article Summary

    Available in Classic and VPC

    Agent installation and management explains supported agent specifications and the installation method. In addition, an description is offered about commands for the agent and resolutions for the problems that could occur related to the agent.

    Supported agent specifications

    The supported specifications for the agent are as follows:

    ItemSupported specifications
    Target serverServer or Auto Scaling Group created on NAVER Cloud Platform
    OSCentOS, Ubuntu, Rocky
    Python versionVersion 2.6 and 2.7
    Note

    You cannot deploy a server created in NAVER Cloud Platform Secure Zone through SourceDeploy.

    Install agent

    To deploy to a server using SourceDeploy, the target server must have the agent for SourceDeploy installed.

    To install the agent, proceed with the following steps in order:

    1. Create API authentication key

    You need an API authentication key to install and use the agent.

    The following describes how to create an API authentication key:

    1. Access NAVER Cloud Platform portal.
    2. Click My page > Manage account > Manage authentication key, in order.
    3. Enter the login password, and then click the [OK] button.
    4. Click the [Create a new API authentication key] button.
      • The created API is displayed in the list.

    2. Compose installation commands

    You can access to the server and compose the installation commands, or compose it in an Init Script.

    See the following according to the composition method:

    Caution

    If you are installing the agent by writing an Init Script from the console, compose the installation commands in the Init Script before creating a project, and then register it when you create the Server or Auto Scaling which is going to be the deployment target.

    Compose after accessing to server

    The following describes how to access to a server and then compose and run the installation commands:

    1. Access to the deployment target server set in the SourceDeploy deployment project.

    2. Enter the commands by referring to the following:

      echo $'NCP_ACCESS_KEY=accesskey\nNCP_SECRET_KEY=secretkey' > /opt/NCP_AUTH_KEY
      chmod 400 /opt/NCP_AUTH_KEY
      wget Agent download address
      chmod 755 install
      ./install
      rm -rf install
      
      • Enter the Access Key ID of the API authentication key created in 1. Create API authentication key in the accesskey field.

      • Enter the Secret key of the API authentication key created in 1. Create API authentication key in the secretkey field.

        • Click the [View] button to see the Secret Key.
        Caution

        You should use the API authentication key whose status is in use. If you use a disabled key, the authentication will fail, even if the agent is running normally, and the deployment through SourceDeploy won't be performed properly.

    To use a disabled key, click the [Use] button to change its status to in use.

     :::
    
    • Enter the agent download address for the applicable Region and use environment in the Agent 다운로드 주소 field.

      Environment
      Region
      Agent download address
      VPCKorea (KR)https://sourcedeploy-agent.apigw.ntruss.com/agent/vpc/download/install
      Singapore (SGN)https://sourcedeploy-agent.apigw.ntruss.com/agent/sg-v1/download/install
      Japan (JPN)https://sourcedeploy-agent.apigw.ntruss.com/agent/jp-v1/download/install
      ClassicKorea (KR)https://sourcedeploy-agent.apigw.ntruss.com/agent/v2/download/install
    • NCP_AUTH_KEY should be created under the server's/opt directory as follows:
      devtools-devtools-4-4_ke

    Compose in Init Script

    If you have composed the installation commands in an Init Script, then it must be registered to Server or Auto Scaling.

    The following describes how to compose the installation commands in an Init Script and register to Server or Auto Scaling:

    1. Access NAVER Cloud Platform console.

    2. Click Services > Compute > Server, in order.

    3. Click the Init Script menu.

    4. Click the [Create Script] button.

    5. Enter the Script name and then select the OS type.

    6. Compose the Script by referring to the following:

      #!/bin/bash
      echo $'NCP_ACCESS_KEY=accesskey\nNCP_SECRET_KEY=secretkey' > /opt/NCP_AUTH_KEY
      chmod 400 /opt/NCP_AUTH_KEY
      wget Agent download address
      chmod 755 install
      ./install
      rm -rf install
      
      • Enter the Access Key ID of the API authentication key created in 1. Create API authentication key in the accesskey field.

      • Enter the secret key of the API authentication key created in 1. Create API authentication key in the secretkey field.

        • Click the [View] button to see the Secret Key.
        Caution

        You should use the API authentication key whose status is in use. If you use a disabled key, the authentication will fail, even if the agent is running normally, and the deployment through SourceDeploy won't be performed properly.

    To use a disabled key, click the [Use] button to change its status to in use.

     :::
    
    • Enter the agent download address for the applicable environment and Region in the Agent 다운로드 주소 field.

      Environment
      Region
      Agent download address
      VPCKorea (KR)https://sourcedeploy-agent.apigw.ntruss.com/agent/vpc/download/install
      Singapore (SGN)https://sourcedeploy-agent.apigw.ntruss.com/agent/sg-v1/download/install
      Japan (JPN)https://sourcedeploy-agent.apigw.ntruss.com/agent/jp-v1/download/install
      ClassicKorea (KR)https://sourcedeploy-agent.apigw.ntruss.com/agent/v2/download/install
    1. Click the [Create Script] button.

    2. Register the Init Script created to Server or Auto Scaling.

    Agent execution commands

    The following are execution commands for the agent:

    Start the agent

    service sourcedeploy start
    

    Stop the agent

    service sourcedeploy stop
    

    Check the agent status

    service sourcedeploy status
    

    Restart the agent

    service sourcedeploy restart
    

    Check agent process

    You can check the agent process to view if the agent is running normally.

    The normal execution criteria for the agent process are as follows:

    • Execute 1 process
    ps -ef | grep main.py
    

    devtools-devtools-4-4_process

    Delete agent

    The following shows how to delete an agent:

    1. Access to the server where the agent is installed, and then stop the agent.
      • The following is the commands to stop the agent:
        service sourcedeploy stop
        
    2. Remove all live processes by checking the agent process.
      • The following are the commands to check and eliminate the agent processes:

        ps -ef | grep main.py
        
        kill -9 PID(ex.3587)
        
    3. Remove the installed agent file.
      • The following is the commands to remove the agent file:
        rm -rf /opt/sdagent
        

    Troubleshooting agent

    When the agent connection doesn't work

    • Enter the agent status check commands and check if the agent has been installed normally.

      service sourcedeploy status
      

      devtools-devtools-4-4_status

    • Check the installed version of the agent.

      cat /opt/sdagent/Agent.ver
      

      <example> As of May 27, 2021

      [VERSION]
      ver=2021/05/18/01
      
      • If the agent installed is an older version, then delete and reinstall the agent.
    • Check if the following agent installation URL is entered in the Init Script.

      • The following are the addresses to download the agent for each use environment and Region:

        Environment
        Region
        Agent download address
        VPCKorea (KR)https://sourcedeploy-agent.apigw.ntruss.com/agent/vpc/download/install
        Singapore (SGN)https://sourcedeploy-agent.apigw.ntruss.com/agent/sg-v1/download/install
        Japan (JPN)https://sourcedeploy-agent.apigw.ntruss.com/agent/jp-v1/download/install
        ClassicKorea (KR)https://sourcedeploy-agent.apigw.ntruss.com/agent/v2/download/install
        wget Agent download address
        
    • Check if the server status is running.

    When the agent processes are not running normally

    Note

    The normal execution criteria for the agent process are as follows:

    • Execute 1 process
    • Enter the restart commands to restart the agent.
      service sourcedeploy restart
      
    • If the problem continues even after restarting, then reinstall the agent.

    When the agent can't be installed

    • Check if the correct authentication key value has been entered.

      cat /opt/NCP_AUTH_KEY
      
    • Check if the path of the script you want to execute has been specified in the first line of the Init Script, in the form of #!/usr/bin/env python, #!/bin/perl, #!/bin/bash, and so on.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.