cpgo

cpgo

Improving my gitlab-ci/distillery deployment

I managed to get a working Gitlab CI setup with a test runner, distillery releases and rsync deployment but I feel there is a lot of room for improvement. This is my config.

I am looking for a better way to send the tarball to my server and start it. My deployment stage feels kinda hacky

deploy:
  image: alpine:3.5
  stage: deploy
  script:
    - apk add --no-cache sshpass rsync openssh
    - sshpass -e rsync -EzavP -e "ssh -o StrictHostKeyChecking=no" build.tar.gz root@${SERVER}:/root
    - sshpass -e ssh root@${SERVER} -o StrictHostKeyChecking=no "_build/prod/rel/my_app/bin/my_app stop ; rm -rf _build ; tar -xzf build.tar.gz ; _build/prod/rel/my_app/bin/my_app start"

Gitlab aparently does not offer a very clean way to manage ssh keys so I skipped the key check :cold_sweat:.
I also need a better way to start the new build on the server, right now I’m just stopping and deleting the old one causing a hiccup in my app :blush: .

I run the migrations on every app startup via distillery hook (source).

#!/bin/sh

# pinging the app and waiting until it's up would probably be nicer
# this file was copied 
sleep 3 

echo "Running migrations"
bin/my_app rpc Elixir.MyApp.Migration migrate

Sure it doesn’t feel ideal, but its very cool to see the pipeline running on gitlab and a few minutes later refreshing the browser to see my app running on linode :slight_smile:

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement