How to support a list of uploads as input with Absinthe GraphQL
As you might guess, in our day-to-day, we write GraphQL queries and mutations for Phoenix applications using Absinthe to be able to create, read, update and delete records.
I successfully deployed an Elixir application to an Amazon EC2 and decided to compile a list of the issues and solutions that I’ve encountered and found little or no information regarding it.
After researching for a few days and asking around in the community I came to the conclusion that in our specific case the best tool to deploy an Elixir application is edeliver. It uses distillery (or exrm) to create a single package with all the code needed to be deployed on a server.
There are still available other ways of deploying an Elixir application to AWS using CodeDeploy, Elastic Beanstalk, Kubernetes and so on. In some of them you lose some functionality of Elixir (Erlang) like hot swap and communication between nodes, but at the moment the simplicity of edeliver is more than enough for my needs.
I followed the README.md
file and it assumes by default that the distillery module is used. That was what I was thinking in using too, but after trying to deploy the application, I got the following message: cat: deps/exrm/mix.exs: No such file or directory
.
In the readme file after the quick start section, you can check that you have this environment variable you can setup to use distillery, which means that setting USING_DISTILLERY=true
solves the issue.
After successfully deploying the service, I couldn’t reach it because the default port wasn’t available (used netstat -tulpn
to check).
If you are deploying a Phoenix application be aware that on prod.exs
file you need to uncomment config :phoenix, :serve_endpoints, true
for the server start to accept requests.
Also if you don’t setup a fixed port, be sure you set an environment variable PORT
with the port you want your web server to be listening, export PORT=80
on the server side, or check RELX_REPLACE_OS_VARS=true
to include this information on the deploy.
If your application is saying that modules are missing, run command mix release
to check what modules is missing on your mix.exs
file.
Some Elixir modules don’t state in their README.md
that you need to explicit include the module on the applications entry and the problem is that on development mode (using mix phx.server
) the application doesn’t show any issue with it.
def application do
[mod: {MyApp, []},
applications: [
:canary,
:corsica,
...
:edeliver
]]
end
I’m still giving my first baby steps towards the Elixir/Erlang work, but I will try to keep this article up to date if I encounter some more issues with it.
Join our newsletter
Be part of our community and stay up to date with the latest blog posts.
SubscribeJoin our newsletter
Be part of our community and stay up to date with the latest blog posts.
SubscribeAs you might guess, in our day-to-day, we write GraphQL queries and mutations for Phoenix applications using Absinthe to be able to create, read, update and delete records.
If you are a Flutter developer you might have heard about or even tried the “new” way of navigating with Navigator 2.0, which might be one of the most controversial APIs I have seen.
A database cron job is a process for scheduling a procedure or command on your database to automate repetitive tasks. By default, cron jobs are disabled on PostgreSQL instances. Here is how you can enable them on Amazon Web Services (AWS) RDS console.