Skip to main content
  1. All Posts/

marketplace-partners

Tools Shell

DigitalOcean Marketplace Partner Tools


This repository contains resources for DigitalOcean Marketplace partners, like documentation on image requirements and creation, tools for image cleanup and validation, and templates for build automation.

Getting Started creating your Kubernetes based 1-Click App

Please visit our Kubernetes Marketplace repo for instructions on how to create and submit your Kubernetes based 1-Click App.
Kubernetes 1-Click Apps can be submitted via our Marketplace Kubernetes Github repo.

Getting Started creating your Droplet based 1-Click App

The overall process for creating an image that you can submit as a Droplet based 1-Click App is as follows:

  1. Create and configure a build Droplet manually first to make sure your configuration works. You can create a build Droplet with any method, like the control panel, the API, or command-line tools like doctl. We strongly encourage you to use a $6 Droplet as your build Droplet. Using a $6 Droplet as your build Droplet will ensure that all Droplet types will be available for usage with your 1-Click App.
  2. Clean up and validate the build Droplet with the provided scripts, cleanup.sh and img_check.sh. The scripts will check for and fix potential security concerns and verify that the image will be compatible with Marketplace.
  3. Use Packer to create a fresh snapshot of the image that you want to create. While there are several ways to create an image, we recommend using Packer as the most simple and consistent option.
  4. Submit your final image to the Marketplace team for review. This can be made through our Vendor Portal. If you’ve signed expressed interest in joining the Marketplace through the form on this page but you’ve not received a login for the Vendor Portal, please reach out to one-clicks-team@digitalocean.com and we’ll help you out.

  1. (Optional) Integrate a DigitalOcean Managed Database into your 1-Click App
    As a Vendor, you can offer a DigitalOcean Managed Database (DBaaS) to any DigitalOcean customer at the time they spin up your Droplet based 1-Click App. You can customize your app image to integrate with the managed database directly, or let your customers complete the configuration themselves after the 1-Click App boots up. This benefits your customers in terms of database scalability and ease of management, and reduces the burden of database support for you as a vendor.
    To enable this option, use the checkboxes that are shown in the Vendor Portal related to enablement of managed databases. If you’ve checked at least 1 box, when a user attempts to create your 1-Click App, they’ll receive a prompt like this one:

    When a user selects the Managed Database option, DigitalOcean handles the creation of the database cluster as well as the user’s Droplet. The Droplet will have a DATABASE_URL environment variable configured including a database connection string, such as:
    postgresql://doadmin:<password>@dbaas-db-11111-do-user-1111111-1.b.db.ondigitalocean.com:25060/defaultdb?sslmode=require
    The user’s managed database configuration and credentials will be stored in /root/.digitalocean_dbaas_credentials in the following format.

    <pre class="notranslate"><code>db_protocol=
    

    db_username= db_password= db_host= db_port= db_database=

    <p>
      To disable this feature for any new users of your 1-Click App, simply visit the Vendor Portal to edit your 1-Click App, removing the checkboxes next to all database engines. Once you save the edits, customers will no longer be given the option to add a managed database. Note that existing customers who have already deployed a managed database in conjunction with your 1-Click App will not be affected by that removal, and their managed databases will continue to operate. </li> </ol> 
      
      <h2 dir="auto">
        <a rel="nofollow noopener" target="_blank" id="user-content-build-automation-with-packer" class="anchor" aria-hidden="true" href="#build-automation-with-packer"></a>Build Automation with Packer
      </h2>
      
      <p>
        <a rel="nofollow noopener" target="_blank" href="https://www.packer.io/intro">Packer</a> is a tool for creating images from a single source configuration. Using this Packer template reduces the entire process of creating, configuring, validating, and snapshotting a build Droplet to a single command:
      </p>
      
      <pre class="notranslate"><code>packer build marketplace-image.json
    

      <p>
        By doing this, there is a reduced likelihood of having to submit an image multiple times as a result of falling in any of the next steps:
      </p>
      
      <ul dir="auto">
        <li>
          Installing OS updates
        </li>
        <li>
          Deleting bash history.
        </li>
        <li>
          Removing log files and SSH keys from the root user
        </li>
        <li>
          Enabling the firewall (i.e. ufw if you use Ubuntu)
        </li>
      </ul>
      
      <p>
        This repository is itself a Packer template for a LAMP stack. You can modify this template to use as a starting point for your image. Note that not all of the scripts/files in this repository are strictly necessary, as this aim at covering a broad case of application.
      </p>
      
      <h2 dir="auto">
        <a rel="nofollow noopener" target="_blank" id="user-content-usage" class="anchor" aria-hidden="true" href="#usage"></a>Usage
      </h2>
      
      <p>
        To run the LAMP stack in this template, you&#8217;ll need to <a rel="nofollow noopener" target="_blank" href="https://www.packer.io/intro/getting-started/install.html">install Packer</a> and <a rel="nofollow noopener" target="_blank" href="https://docs.digitalocean.com/reference/api/create-personal-access-token/">create a DigitalOcean personal access token</a> and set it to the <code>DIGITALOCEAN_TOKEN</code> environment variable. Running <code>packer build marketplace-image.json</code> without any other modifications will create a build Droplet configured with LAMP, clean and verify it, then power it down and snapshot it.<br /> To start adapting this template for your own image, you can customize some variables in <code>marketplace-image.json</code>:
      </p>
      
      <ul dir="auto">
        <li>
          <code>apt_packages</code> lists the APT packages to install on the build Droplet.
        </li>
        <li>
          <code>image_name</code> defines the name of the resulting snapshot, which by default is <code>marketplace-snapshot-</code> with a UNIX timestamp appended.
        </li>
      </ul>
      
      <p>
        You can also modify these variables at runtime by using <a rel="nofollow noopener" target="_blank" href="https://www.packer.io/docs/templates/legacy_json_templates/user-variables">the <code>-var</code> flag</a>.<br /> Please see the RStudio Server 1-Click Scripts to see an example of Packer usage.<br /> A successful run would look like this output:
      </p>
      
      <pre class="notranslate"><code>pacha@pop-os:~/github/marketplace-partners$ packer build marketplace-image.json
    

    digitalocean output will be in this color.

    ==> digitalocean: Creating temporary ssh key for droplet… ==> digitalocean: Creating droplet… ==> digitalocean: Waiting for droplet to become active… ==> digitalocean: Using ssh communicator to connect: 165.227.211.66 ==> digitalocean: Waiting for SSH to become available… ==> digitalocean: Connected to SSH! ==> digitalocean: Provisioning with shell script: /tmp/packer-shell581341144 digitalocean: ……………………………………………………. digitalocean: status: done ==> digitalocean: Uploading files/etc/ => /etc/ ==> digitalocean: Uploading files/var/ => /var/ ==> digitalocean: Provisioning with shell script: /tmp/packer-shell079619818 digitalocean: digitalocean: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

    ...
    
    digitalocean: The following NEW packages will be installed:
    digitalocean:   linux-headers-5.4.0-66 linux-headers-5.4.0-66-generic
    
    digitalocean: The following packages will be upgraded:
    digitalocean:   accountsservice alsa-ucm-conf apport apt apt-utils base-files bind9-dnsutils
    
    ... MANY MORE LINES OMITTED HERE ...
    
    digitalocean: Distribution: Ubuntu
    digitalocean: Version: 20.04
    digitalocean:
    digitalocean: [PASS] Supported Operating System Detected: Ubuntu
    digitalocean: [PASS] Supported Release Detected: 20.04
    digitalocean: [PASS] Cloud-init is installed.
    digitalocean: [PASS] Firewall service (ufw) is active
    digitalocean:
    digitalocean: Updating apt package database to check for security updates, this may take a minute...
    digitalocean:
    digitalocean: [PASS] There are no pending security updates for this image.
    digitalocean:
    digitalocean:
    digitalocean: Checking for log files in /var/log
    digitalocean:
    digitalocean: [WARN] un-cleared log file, /var/log/auth.log found
    digitalocean: [WARN] un-cleared log file, /var/log/ufw.log found
    digitalocean:
    digitalocean:
    digitalocean: Checking all user-created accounts...
    digitalocean:
    digitalocean:
    digitalocean: Checking the root account...
    digitalocean: [PASS] User root has no password set.
    digitalocean: [ OK ] User root has no SSH keys present
    digitalocean: [PASS] root's Bash History appears to have been cleared
    digitalocean: [PASS] DigitalOcean Monitoring agent was not found
    digitalocean: [PASS] MongoDB is not installed
    digitalocean: