<commit_before>heat_template_version: 2013-05-23

description: |
  A template that deploys open source Drone.io onto a single Linux server.

parameter_groups:

- label: Server Settings
  parameters:
  - flavor
  - image

- label: rax-dev-params
  # These are parameters that will not be displayed in the portal. The purpose
  # of these parameters are for users who are developing or testing newer or
  # different setups. If any of these parameters are changed, there is a good
  # chance this stack will fail to properly deploy.
  parameters:
  - drone_deb_location
  - server_name

parameters:

  flavor:
    label: Server Size
    description: |
      Rackspace Cloud Server flavor to use. The size is based on the amount of
      RAM for the provisioned server.
    type: string
    default: 1 GB Performance
    constraints:
      - allowed_values:
        - 1 GB Performance
        - 2 GB Performance
        - 4 GB Performance
        - 8 GB Performance
        - 15 GB Performance
        - 30 GB Performance
        - 1GB Standard Instance
        - 2GB Standard Instance
        - 4GB Standard Instance
        - 8GB Standard Instance
        - 15GB Standard Instance
        - 30GB Standard Instance
        description: must be a valid Rackspace Cloud Server flavor.

  image:
    label: Operating System
    description: |
      Server image used for all servers that are created as a part of this
      deployment
    type: string
    default: Ubuntu 14.04 LTS (Trusty Tahr)
    constraints:
    - allowed_values:
      - Ubuntu 14.04 LTS (Trusty Tahr)
      description: Must be a supported operating system.

  server_name:
    label: Server Hostname
    description: The instance name
    type: string
    default: drone

  drone_deb_location:
    label: Drone DEB Location
    description: Location of the Drone Deb File
    type: string
    default: |
      http://downloads.drone.io/latest/drone.deb

resources:

  ssh_key:
    type: "OS::Nova::KeyPair"
    properties:
      name: { get_param: "OS::stack_id" }
      save_private_key: true

  drone:
    type: "Rackspace::Cloud::Server"
    properties:
      key_name: { get_resource: ssh_key }
      flavor: { get_param: flavor }
      image: { get_param: image }
      name: { get_param: server_name }
      metadata:
        rax-heat: { get_param: "OS::stack_id" }
      user_data:
        str_replace:
          template: |
            #!/bin/bash -v
            # Install Dependencies
            apt-get install -y python-pip
            # Install Docker
            curl -sSL https://get.docker.io/ubuntu/ | sh
            # Install docker-py
            pip install docker-py
            # Generate self signed certificate
            SERVER_IP=`ifconfig eth0 | grep "inet addr:" | cut -d: -f2 | awk '{print $1}'`
            mkdir -p /etc/drone/ssl
            openssl req -new -newkey rsa:4096 -nodes -x509 -subj "/C=US/ST=Texas/L=San Antonio/O=Drone/CN=${SERVER_IP}" -keyout /etc/drone/ssl/drone.key -out /etc/drone/ssl/drone.crt
            # Download DEB and Install
            wget -ct0 %drone_deb_location%
            dpkg -i drone.deb
            # Configure and Restart Drone
            echo 'DRONED_OPTS="--port=:443 --sslcert=/etc/drone/ssl/drone.crt --sslkey=/etc/drone/ssl/drone.key"' >> /etc/default/drone
            stop drone
            start drone
            # Open and Enable ufw
            ufw allow 443
            ufw allow 22
            ufw enable
          params:
            "%drone_deb_location%": { get_param: drone_deb_location }

outputs:
  private_key:
    description: SSH Private Key
    value: { get_attr: [ssh_key, private_key] }

  drone_url:
    value:
      str_replace:
        template: "https://%server_ip%"
        params:
          "%server_ip%": { get_attr: [ drone, accessIPv4 ] }
    description: Drone URL

  server_ip:
    value: { get_attr: [ drone, accessIPv4 ] }
    description: Server IP
<commit_msg>adding the --force option to the ufw call<commit_after>heat_template_version: 2013-05-23

description: |
  A template that deploys open source Drone.io onto a single Linux server.

parameter_groups:

- label: Server Settings
  parameters:
  - flavor
  - image

- label: rax-dev-params
  # These are parameters that will not be displayed in the portal. The purpose
  # of these parameters are for users who are developing or testing newer or
  # different setups. If any of these parameters are changed, there is a good
  # chance this stack will fail to properly deploy.
  parameters:
  - drone_deb_location
  - server_name

parameters:

  flavor:
    label: Server Size
    description: |
      Rackspace Cloud Server flavor to use. The size is based on the amount of
      RAM for the provisioned server.
    type: string
    default: 1 GB Performance
    constraints:
      - allowed_values:
        - 1 GB Performance
        - 2 GB Performance
        - 4 GB Performance
        - 8 GB Performance
        - 15 GB Performance
        - 30 GB Performance
        - 1GB Standard Instance
        - 2GB Standard Instance
        - 4GB Standard Instance
        - 8GB Standard Instance
        - 15GB Standard Instance
        - 30GB Standard Instance
        description: must be a valid Rackspace Cloud Server flavor.

  image:
    label: Operating System
    description: |
      Server image used for all servers that are created as a part of this
      deployment
    type: string
    default: Ubuntu 14.04 LTS (Trusty Tahr)
    constraints:
    - allowed_values:
      - Ubuntu 14.04 LTS (Trusty Tahr)
      description: Must be a supported operating system.

  server_name:
    label: Server Hostname
    description: The instance name
    type: string
    default: drone

  drone_deb_location:
    label: Drone DEB Location
    description: Location of the Drone Deb File
    type: string
    default: |
      http://downloads.drone.io/latest/drone.deb

resources:

  ssh_key:
    type: "OS::Nova::KeyPair"
    properties:
      name: { get_param: "OS::stack_id" }
      save_private_key: true

  drone:
    type: "Rackspace::Cloud::Server"
    properties:
      key_name: { get_resource: ssh_key }
      flavor: { get_param: flavor }
      image: { get_param: image }
      name: { get_param: server_name }
      metadata:
        rax-heat: { get_param: "OS::stack_id" }
      user_data:
        str_replace:
          template: |
            #!/bin/bash -v
            # Install Dependencies
            apt-get install -y python-pip
            # Install Docker
            curl -sSL https://get.docker.io/ubuntu/ | sh
            # Install docker-py
            pip install docker-py
            # Generate self signed certificate
            SERVER_IP=`ifconfig eth0 | grep "inet addr:" | cut -d: -f2 | awk '{print $1}'`
            mkdir -p /etc/drone/ssl
            openssl req -new -newkey rsa:4096 -nodes -x509 -subj "/C=US/ST=Texas/L=San Antonio/O=Drone/CN=${SERVER_IP}" -keyout /etc/drone/ssl/drone.key -out /etc/drone/ssl/drone.crt
            # Download DEB and Install
            wget -ct0 %drone_deb_location%
            dpkg -i drone.deb
            # Configure and Restart Drone
            echo 'DRONED_OPTS="--port=:443 --sslcert=/etc/drone/ssl/drone.crt --sslkey=/etc/drone/ssl/drone.key"' >> /etc/default/drone
            stop drone
            start drone
            # Open and Enable ufw
            ufw allow 443
            ufw allow 22
            ufw --force enable
          params:
            "%drone_deb_location%": { get_param: drone_deb_location }

outputs:
  private_key:
    description: SSH Private Key
    value: { get_attr: [ssh_key, private_key] }

  drone_url:
    value:
      str_replace:
        template: "https://%server_ip%"
        params:
          "%server_ip%": { get_attr: [ drone, accessIPv4 ] }
    description: Drone URL

  server_ip:
    value: { get_attr: [ drone, accessIPv4 ] }
    description: Server IP

{'fraction_non_alphanumeric': 0.08108108108108109, 'fraction_numerical': 0.013639808032331396, 'mean_word_length': 2.106708513142409, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2578687', 'n_tokens_mistral': 2498, 'n_tokens_neox': 2327, 'n_words': 760}