Github action to deploy a meteor app to digital ocean
Why no galaxy ?
My main app (https://ciboulette.net) is a meteor app. I love meteor, and I'm glad it's recently received some new funding and new updates.
However, the official way to host a meteor app, meteor galaxy, is super expensive for a small indie project. I can understand that server costs are usually not significant, but if i can get away with 15$ a month instead of 115$ well rather do that.
Of course if I had to pay someone 100$/hour to manage my servers, it would be a different story.

Anyway, i'm really happy with my meteor up + digital ocean setup, but the deploys take forever when you have a bad DSL connection (0.8 MB/s upload, whoo) so I looked for a way to get my deploys to happen in the cloud.
The cheapest (free) and simplest solution I found was github actions.
Here's the github action for one of my open source repositories : https://github.com/renanlecaro/simpletextnet/blob/master/.github/workflows/main.yml
The idea is :
- Get "mup deploy" working locally
- Add the required ssh keys to the github action runner as secrets
- Run mup deploy from the runner
It's not rocket science, really, it was just not as straighforward as I hoped it would be.
Below, the main action code
name: Deploy meteor app to digital ocean with meteor up
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# we setup ssh first as it is quick, so the action will fail
# fast during the installation on a new repository
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
# just a dummy request to check the communication with the server
# is ok, we'll upload after building
- name: Test ssh key to fail fast
run: ssh [email protected] -t "pwd"
# get the source
- uses: actions/checkout@v2
# install only the production dependencies
- name: get production dependencies only
run: npm install --production
# install mup without the -g flag
- name: install mup locally
run: npm install mup
# install meteor to be able to build the app as a bundle
- name: install meteor
run: curl https://install.meteor.com/ | sh
# upload the bundle. Here, the .production folder is app specific.
# You need to get to the folder with your mup.js file.
- name: Bundle the app and upload to Digital Ocean
run: cd ./.production && npx mup deploy