How to run a simple .exs script or elixir app on gigalixir?

Hello friends
I tried a lot to run an .exs script or elixir app but could not
I do not use Phoenix
Do you have any training on this?

Hi @edxofp. Any time you want to ask others to help you with a programming problem you always need to supply:

  1. What code are you trying to run
  2. How did you try to run it?
  3. What error happened?

Ideally with as much copy and paste as possible.

Imagine someone asked you a question with the content you have provided us. How could you possibly help them?

3 Likes

For example, I have a program like this

defmodule Main do
  def start do
    case HTTPoison.get("url") do
      {:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
        response = Poison.decode!(body)
        price = response["price"]

        if price >= 5 do
          IO.puts("#{price}")
          Process.sleep(20_000)
          start()
        else
          Process.sleep(5_000)
          start()
        end

      {:error, %HTTPoison.Error{}} ->
        start()
    end
  end
end

Main.start()

I want this code to run around the clock
One way is to buy a VPS
But I want to know if there is another way I can keep this code running at minimal cost
Such as the services of gigalixir.com and fly.io
No matter how hard I tried, I couldn’t
I do not know how to run this simple script on these sites
Because in the doc of these sites, Phoenix is talked about

Thanks

Have you gotten through Elixir’s OTP tutorial on the official website?

Having something like this run 24/7 is a very normal use-case for Elixir.

it’s true
But where do I host this code?
Except for the VPS purchase method

Gigalixir should work fine. Haven’t used it in a while but once you go through the first deployment, it’s no problem.

Furthermore, “I tried hard” and “I tried a lot” does not give any information about what went wrong.

So what went wrong then?

If you want to use gigalixir, you need to follow gigalixir’s tutorial. Just remove everything you don’t need.