Part 4: DigitalOcean App Platform Hackathon Submission

jonjam

Jonathan Harrison

Posted on December 26, 2020

Part 4: DigitalOcean App Platform Hackathon Submission

This post is part of a series detailing my journey with golang from learning the language to entering the DigitalOcean App Platform Hackathon.

The app I built can be found on GitHub.

Part 4 details the DigitalOcean App Platform Hackathon submission and how it is deployed.

What I built

Category Submission

Random Roulette

App Link

N/A

Screenshots

Alt Text

Description

stock-checker is a golang app that spawns a task every hour to check whether any of the following UK retailers have an Xbox Series X console in stock:

This is done using a web automation library that navigates each site in a headless chromium browser.

If the app determines stock is available, a text message is sent using Twilio to the configured mobile number.

This is deployed to a DigitalOcean App Platform Worker using a Dockerfile.

Link to Source Code

GitHub

Permissive License

MIT

Background

See Part 1 of this series.

How I built it

See Part 3 of this series.

Hosting and deployment

This golang app is deployed using docker to a Worker component on DigitalOcean's App Platform.

The DO App is defined using an Application Reference specification which is shown below:

name: stock-checker-app
region: fra
workers:
- name: bg-worker-stock-checker
  github:
    branch: main
    deploy_on_push: true
    repo: JonJam/stock-checker
  dockerfile_path: Dockerfile
  instance_count: 1
  instance_size_slug: basic-xs
  envs:
  - key: SC_TWILIO_ENABLED
    scope: RUN_AND_BUILD_TIME
    value: "true"
  - key: SC_TWILIO_ACCOUNTSID
    scope: RUN_AND_BUILD_TIME
    type: SECRET
    value: ""
  - key: SC_TWILIO_AUTHTOKEN
    scope: RUN_AND_BUILD_TIME
    type: SECRET
    value: ""
  - key: SC_TWILIO_NUMBERTO
    scope: RUN_AND_BUILD_TIME
    type: SECRET
    value: ""
  - key: SC_TWILIO_NUMBERFROM
    scope: RUN_AND_BUILD_TIME
    type: SECRET
    value: ""
Enter fullscreen mode Exit fullscreen mode

This App was then deployed using doctl.

Originally I was going to use a Deploy to DigitalOcean button, however worker components are not currently supported.

Prior to this project, I wasn't familiar with Digital Ocean so using the App Platform was new to me. The resources I found useful are listed below:

Additional Resources / Info

-

💖 💪 🙅 🚩
jonjam
Jonathan Harrison

Posted on December 26, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Part 1: Background and learning golang
dohackathon Part 1: Background and learning golang

December 26, 2020

Part 2: Development environment
dohackathon Part 2: Development environment

December 26, 2020

Part 3: Developing stock-checker app
dohackathon Part 3: Developing stock-checker app

December 26, 2020