Hi everyone, I’ve been trying to create an automated deployment flow using github actions where I build on their ubuntu 20.04 runner and rsync the built release folders to a digital ocean ubuntu 20.04 droplet.
The action completes okay, sends the files to the prod server, but I’m getting this error on start:
sh: 1: exec: inet_gethost: not found
I’m guessing that it’s a build target mismatch issue, but I’m not sure why? Has anyone else deployed a raw mix release built with github actions - that is, without deploying it in a docker container? I don’t really want to install erlang, elixir, mix etc. to the production machine and I’d like to not use docker in production if I don’t have to.
Here’s my github action workflow:
name: Elixir Release
on: workflow_dispatch
jobs:
test:
runs-on: ${{ matrix.os }}
name: OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }} | Node ${{ matrix.node }} | OS ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
otp: ['23.1']
elixir: ['1.11.1']
node: [12.x]
#services:
#db:
# image: postgres:11
# ports: ['5432:5432']
# env:
# POSTGRES_PASSWORD: postgres
# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1.0.0
- uses: erlef/setup-elixir@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: cache-deps
id: cache-deps
uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix-
- name: cache-build
id: cache-build
uses: actions/cache@v2
with:
path: _build
key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix-build
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-mix-
- name: Install mix dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Install js assets
run: yarn --cwd assets install
- name: Prepare release
run: |
mix compile
yarn --cwd assets deploy
mix phx.digest
mix release
env:
MIX_ENV: prod
- name: Get datetime
run: echo "now=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
- name: Deploy to Prod server
uses: easingthemes/ssh-deploy@v2.1.5
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD_SECRET_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "./_build/prod/rel/myapp"
REMOTE_HOST: ${{ secrets.PROD_SSH_HOST }}
REMOTE_USER: ${{ secrets.PROD_SSH_USER }}
TARGET: ~/releases/${{ env.now }}