Screwdriver V4 Onboarding (KEEP UPDATING) - adong/sd-wiki GitHub Wiki

Screwdriver V4 Onboarding

Step1: Map domain name sd.localhost.com to your ip in hosts file

  • Append this line to your /etc/hosts file:

    127.0.0.1 sd.localhost.com
    

Step2: Create a new Github OAuth Application

Go to Settings > Developer settings > OAuth Apps, click New OAuth App button and configure as described below:

Take note of the client ID and the client Secret, you'll need them in following steps

Step3: Clone needed github repos from screwdriver-cd organization:

  • ui
  • screwdriver
  • store

Step4: Add local config files for these three repos

Create a file called local.js in ui/config and local.yaml in screwdriver/config and store/config folders.

ui/config/local.js

let SDAPI_HOSTNAME;
let SDSTORE_HOSTNAME;

SDAPI_HOSTNAME = 'http://sd.localhost.com:9001';
SDSTORE_HOSTNAME = 'http://sd.localhost.com:9002';

module.exports = {
  SDAPI_HOSTNAME,
  SDSTORE_HOSTNAME
};

screwdriver/config/local.yaml

  • Remember to fill in your Github OAuth client id and OAuth client secret, you can find them in the OAuth application you created in Step2

  • Remember to generate your own jwtPrivateKey and jwtPublicKey using

    openssl genrsa -out jwt.pem 2048
    openssl rsa -in jwt.pem -pubout -out jwt.pub
    
  • Remember to create a folder called "mw-data": mkdir mw-data

  • Look up your ip first: ifconfig, YOUR_IP

You may need to update this IP because of location changes.

auth:
    jwtPrivateKey: |
        -----BEGIN RSA PRIVATE KEY-----
        *********SOME KEYS HERE********
        -----END RSA PRIVATE KEY-----

    jwtPublicKey: |
        -----BEGIN PUBLIC KEY-----
        ******SOME KEYS HERE******
        -----END PUBLIC KEY-----

httpd:
  # Port to listen on
  port: 9001

  # Host to listen on (set to localhost to only accept connections from this machine)
  host: 0.0.0.0

  # Externally routable URI (usually your load balancer or CNAME)
  # This requires to be a routable IP inside docker for executor, see 
  # https://github.com/screwdriver-cd/screwdriver/blob/095eaf03e053991443abcbde91c62cfe06a28cba/lib/server.js#L141
  uri: http://YOUR_IP:9001 

ecosystem:
  # Externally routable URL for the User Interface
  ui: http://sd.localhost.com:4200

  # Externally routable URL for the Artifact Store
  # store: http://sd.localhost.com:9002
  # This will be accessed from docker image, so has to be publicly routable
  store: http://YOUR_IP:9002 
    
  allowCors: ['http://sd.localhost.com']

executor:
    plugin: docker
    docker:
        enabled: true
        options:
            docker:
                socketPath: "/var/run/docker.sock"

scms:
    github:
        plugin: github
        config:
            # github
            oauthClientId: your-oauth-client-id
            oauthClientSecret: your-oauth-client-secret
            secret: a-really-real-secret
            username: sd-buildbot
            email: [email protected]
    localhost:
        plugin: github
        config:
            # git localhost
            oauthClientId: your-oauth-client-id
            oauthClientSecret: your-oauth-client-secret
            gheHost: git.localhost.com
            secret: a-really-real-secret
            username: sd-buildbot
            email: [email protected]

datastore:
  plugin: sequelize
  sequelize:
    # Type of server to talk to
    dialect: sqlite
    # Storage location for sqlite
    storage: ./mw-data/storage.db

store/config/local.yaml

auth:
    # A public key for verifying JWTs signed by api.screwdriver.cd
    jwtPublicKey: |
        -----BEGIN PUBLIC KEY-----
        ******SOME KEYS HERE******
        -----END PUBLIC KEY-----

strategy:
    plugin: disk
    disk:
        cachePath: './store-data'
        cleanEvery: 3600000
        partition : 'cache'

httpd:
    port: 9002

ecosystem:
    # Externally routable URL for the User Interface
    ui: http://sd.localhost.com:4200
    
    # Externally routable URL for the Artifact Store
    api: http://sd.localhost.com:9001
    
    allowCors: ['http://sd.localhost.com']

Step5: Install dependencies and you are ready to go!

Just need to run below commands inside each repo

npm install && npm run start

Other Resources

Screwdrvier API