sensiblearts

sensiblearts

Mix release on WSL deployed phoenix to GCE, same architecture :-) and a few questions

Sharing my deployment experience, fyi:

I wanted managed SQL and I decided to try Google Compute Engine for my first phoenix app, and had the pleasant discovery that the architecture and OS can be set to match my WSL dev laptop (x86, Ubuntu 16, gnu).

There are a lot of detailed steps (and quirks) but they’re (mostly) understandable in retrospect; in brief, the general steps were:

  1. create a cloud SQL Postgres instance and run laptop MIX_ENV=prod mix phx.server pointed at it (using cloud_sql_proxy on the laptop); once that was confirmed to work,
  2. MIX_ENV=prod mix release beta1
  3. Use Ansible (and its gcp_compute plugin) to get an inventory of “webserver” instances and copy all of _build/prod/rel/beta1 out to the instance(s) – and this tutorial helped a lot
  4. Manually chmod permissions on erl and releases folders, make tmp writeable
  5. Start cloud_sql_proxy
  6. ./bin/beta1 start

If anyone is interested I can write up the details once I get it automated more with ansible and gcloud. ( I won’t build any roles, just playbooks.) (It’s also talking to couchdb on another instance.)

A few questions:

Q1. Is there any reason not to proceed with this WSL build-straight-to-GCE approach? (I know I could build on GCE, but if WSL works, why not?)

Q2. Everything under the /rel/beta1 folder was 59MB, which took a very long time (2 hours? why?) to copy out with ansible. Wondering about how to approach this: Compress to a file and unpack on the server?

Q3. Regarding the “Directory Structure” section at https://hexdocs.pm/mix/master/Mix.Tasks.Release.html, it would be great to see a table with 3 columns: files, purposes, typical permissions settings. (I assume /tmp is only one that needs write?)

Thanks for reading,
DA

First Post!

mbuhot

mbuhot

For commercial apps I’d usually build a release artifact on a CI server and publish it to some storage for deployment. Eg if you want to auto scale scale nodes at runtime they can fetch the release at startup.

The release should contain a tar file with everything included. Haven’t tried the built in mix support, but I think it is created by default with distillery in prod mode.

Where Next?

Popular in Questions Top

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
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

Other popular topics Top

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
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
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement