CID-Drone (BLOCKED)

Last modified by Christian Reiber on 2021/09/24 19:38

Purpose

This software stack provides Drone, a Continuous Integration (CI) and Continuous Deployment (CD) service built on Docker container technology.

Properties

 Stack-Description  Drone Continuous Integration/Deployment (CID)    
 Stack-Image        docker.msg.team/ps/docker-stack-cid-drone   
 Stack-Version      1.10.1 
 Stack-Release      20210121 
 Product-Name  Drone 
 Product-Vendor  Drone.IO, Inc. 
 Product-Contact  https://drone.io/ 
 Product-Model  Open Source 
 Product-License  Apache 
 Product-Limits  none 
Implementation Base  The Go Programming Language.
Execution Base       Go.
Initial Start Time   00:00:02
Documentation       https://docs.drone.io/

Topology

The stack consists of 3 containers:

  • cid-drone: the Drone continuous delivery platform application.
  • cid-drone-dind: the Docker-in-Docker container for Drone.
  • cid-drone-postgresql: the PostgreSQL database.

Configuration

Variable Name       Default Meaning  
CFG_DRONE_SERVERyesIf this is set to "no" then the Drone server is removed from the supervisord configuration. i.e. the server will not be started. 
CFG_DRONE_RUNNER_DOCKERyesIf this is set to "no" then the Docker runner is removed from the supervisord configuration, i.e. docker commands cannot be executed via the docker runner. 
CFG_DRONE_RUNNER_KUBEno- unused - 
CFG_DRONE_RUNNER_SSHnoIf this is set to "no" then the SSH runner is removed from the supervisord configuration, i.e. docker commands cannot be executed via the SSH runner. 
CFG_DRONE_RUNNER_EXECno- unused - 
CFG_DRONE_RPC_SECRETsecretThis is the password used internally to connect to the RCP agent. 
CFG_DRONE_ADMIN_TOKEN00000000000000000000000000000000This is the token used to configure the intial administrator account. 
CFG_DRONE_DOCKERtcp://dind:2375- unused - 
CFG_DRONE_GIT_USERNAME This can be used to configure central Git authentication if the git needs authentication also for public repositories  or a central fixed user for private repositories 
CFG_DRONE_GIT_PASSWORD This configures the passwort for the user above. 
CFG_DRONE_GIT_ALWAYS_AUTHfalseTells Drone whether the git user will authenticate for each call. 
CFG_DRONE_FILTER_USERS This sets the DRONE_USER_FILTER variable. If set, only users in this list can authenticate.  See the Drone documenation for details. 
CFG_DRONE_FILTER_REPOS This sets the DRONE_REPOSITORY_FILTER variable. See the Drone documenation for details. 
CFG_DRONE_GITEAhttp://vcs-gitea.proxy:8080This sets the connection from Drone to Gitea. 
CFG_DRONE_GITEA_IDdroneThis sets the DRONE_GITEA_CLIENT_ID variable. See the Drone documenation for details. 
CFG_DRONE_GITEA_SECRETdroneThis sets the secret used to authenticate to Gitea. 
CFG_DRONE_VCS_SKIP_VERIFYfalseThis sets the DRONE_GITEA_SKIP_VERIFY variable. See the Drone documenation for details. 
CFG_DRONE_RUNNER_VOLUMES This sets the DRONE_RUNNER_VOLUMES variable. See the Drone documenation for details. 
CFG_DRONE_RUNNER_ENVIRON This sets the DRONE_RUNNER_ENVIRON variable. See the Drone documenation for details. 

See also the variables which control integration of the stack into the reverse proxy.
For changes to take effect the stack has to be reinstalled.

Setup Prerequisites

Drone requires a connection to Gitea. Either connect to an existing repository where you have access to or install the Stack VCS-Gitea.
In Gitea, you need to setup the OAuth2 configuration for Drone:

  • In Gitea, as an administrative user, go to "Settings/Applications".
  • In the section "Create a new OAuth2 Application" create a new application using those two parameters:
  • Important On the following screen, copy the two values for those fields:
    • Client ID
    • Client Secret
  • Those two values need to be entered in the next step configuring CID-Drone.

Unfortunately, Drone does not support running under a sub-url (e.g. https://myhost.example.com/cid-drone/). Therefore a special setup is necessary to let Drone execute in a document root context, i.e. it looks like Drone is running on its own web server, e.g. https://drone.myhost.example.com/. In fact the PS4 reverse proxy does the necessary magic to establish this virtual FQDN. But it has to be directed to do so, therefore apply the following configuration before installing the cid-drone stack:

docker-stack configure params cid-drone \
  DOCKER_STACK_URL_HOST=drone.myhost.example.com \
  CFG_DRONE_GITEA=https://myhost.example.com/vcs-gitea/ \
  CFG_DRONE_GITEA_ID=<Client ID from above> \
  CFG_DRONE_GITEA_SECRET=<Client Secret from above>

After that, if you run your server with https you have to put appropriate SSL Certificate, Certificate Chain and Key files for the virtual FQDN into directory /var/lib/docker-stack/conf.

Issue: After this step, Gitea and Drone won't talk to each other: Trying to log in to Drone results in this message shown in the browser:
Login Failed. Post https://ps4-tsc/vcs-gitea/login/oauth/access_token: dial tcp: lookup ps4-tsc on 127.0.0.11:53: no such host
The URL in the example is https://drone.ps4-tsc/login/error?message=Post%20https%3A%2F%2Fps4-tsc%2Fvcs-gitea%2Flogin%2Foauth%2Faccess_token%3A%20dial%20tcp%3A%20lookup%20ps4-tsc%20on%20127.0.0.11%3A53%3A%20no%20such%20host

Initial Configuration

Usually, there is no need to configure anything to get up and running.
The default user to access the Tomcat Server Manager is "admin" with password "admin". It is available at <your-ps-server>/ase-tomcat/manager/.

This default admin password change be changed inside the ase-tomcat container in the file /app/lib/tomcat/conf/tomcat-users.xml.

Administration Commands

Command Arguments Function  
docker-stack exec cid-drone drone<DRONE_SERVER> <DRONE_TOKEN>See the Drone documentation for the details for those two parameters.

Related Documents

 

Tags:
Created by Thomas Schoepf on 2020/04/03 08:30

Navigation