biske

biske

Hi, I’m following phoenix/guides/deployment/heroku.md at main · phoenixframework/phoenix · GitHub to deploy using Heroku containers.

Here’s the example repo: GitHub - biske/hello: Basic Phoenix application to test deployment to Heroku · GitHub

When I push to heroku I get following error:

Apples-MacBook-Pro:hello ivanbisevac$ git push heroku master
Enumerating objects: 83, done.
Counting objects: 100% (83/83), done.
Delta compression using up to 8 threads
Compressing objects: 100% (75/75), done.
Writing objects: 100% (83/83), 97.06 KiB | 6.93 MiB/s, done.
Total 83 (delta 4), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: === Fetching app code
remote: 
remote: === Building web (Dockerfile)
remote: Sending build context to Docker daemon  368.6kB
remote: Step 1/25 : FROM elixir:1.9.0-alpine AS build
remote: 1.9.0-alpine: Pulling from library/elixir
remote: e7c96db7181b: Pulling fs layer
remote: c306444e2774: Pulling fs layer
remote: 4b80324f258b: Pulling fs layer
remote: e7c96db7181b: Verifying Checksum
remote: e7c96db7181b: Download complete
remote: 4b80324f258b: Verifying Checksum
remote: 4b80324f258b: Download complete
remote: e7c96db7181b: Pull complete
remote: c306444e2774: Verifying Checksum
remote: c306444e2774: Download complete
remote: c306444e2774: Pull complete
remote: 4b80324f258b: Pull complete
remote: Digest: sha256:bd6e03f00f57a121f6f31374d693e9027ce6053e25700be4d7c64f83dd249a56
remote: Status: Downloaded newer image for elixir:1.9.0-alpine
remote:  ---> 7a6d28e4b511
remote: Step 2/25 : RUN apk add --update build-base npm git
remote:  ---> Running in 244929b60841
remote: fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
remote: fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
remote: (1/31) Upgrading musl (1.1.20-r4 -> 1.1.20-r5)
remote: (2/31) Installing binutils (2.31.1-r2)
remote: (3/31) Installing libmagic (5.36-r1)
remote: (4/31) Installing file (5.36-r1)
remote: (5/31) Installing gmp (6.1.2-r1)
remote: (6/31) Installing isl (0.18-r0)
remote: (7/31) Installing libgomp (8.3.0-r0)
remote: (8/31) Installing libatomic (8.3.0-r0)
remote: (9/31) Installing libgcc (8.3.0-r0)
remote: (10/31) Installing mpfr3 (3.1.5-r1)
remote: (11/31) Installing mpc1 (1.0.3-r1)
remote: (12/31) Installing libstdc++ (8.3.0-r0)
remote: (13/31) Installing gcc (8.3.0-r0)
remote: (14/31) Installing musl-dev (1.1.20-r5)
remote: (15/31) Installing libc-dev (0.7.1-r0)
remote: (16/31) Installing g++ (8.3.0-r0)
remote: (17/31) Installing make (4.2.1-r2)
remote: (18/31) Installing fortify-headers (1.0-r0)
remote: (19/31) Installing build-base (0.5-r1)
remote: (20/31) Installing nghttp2-libs (1.35.1-r1)
remote: (21/31) Installing libssh2 (1.9.0-r1)
remote: (22/31) Installing libcurl (7.64.0-r3)
remote: (23/31) Installing expat (2.2.8-r0)
remote: (24/31) Installing pcre2 (10.32-r1)
remote: (25/31) Installing git (2.20.1-r0)
remote: (26/31) Upgrading musl-utils (1.1.20-r4 -> 1.1.20-r5)
remote: (27/31) Installing c-ares (1.15.0-r0)
remote: (28/31) Installing http-parser (2.8.1-r0)
remote: (29/31) Installing libuv (1.23.2-r0)
remote: (30/31) Installing nodejs (10.14.2-r0)
remote: (31/31) Installing npm (10.14.2-r0)
remote: Executing busybox-1.29.3-r10.trigger
remote: OK: 235 MiB in 51 packages
remote: Removing intermediate container 244929b60841
remote:  ---> c32d9dd1e1ab
remote: Step 3/25 : RUN mkdir /app
remote:  ---> Running in 1421ee00b856
remote: Removing intermediate container 1421ee00b856
remote:  ---> 99aace19d0bf
remote: Step 4/25 : WORKDIR /app
remote:  ---> Running in e1cb3f87b4d0
remote: Removing intermediate container e1cb3f87b4d0
remote:  ---> c37e5c3877f2
remote: Step 5/25 : RUN mix local.hex --force &&     mix local.rebar --force
remote:  ---> Running in 35ced8130ede
remote: * creating /root/.mix/archives/hex-0.20.1
remote: * creating /root/.mix/rebar
remote: * creating /root/.mix/rebar3
remote: Removing intermediate container 35ced8130ede
remote:  ---> afa2e665d580
remote: Step 6/25 : ENV MIX_ENV=prod
remote:  ---> Running in f5b1950ab144
remote: Removing intermediate container f5b1950ab144
remote:  ---> 8e416fc55c15
remote: Step 7/25 : COPY mix.exs mix.lock ./
remote:  ---> 2c89dc19046c
remote: Step 8/25 : COPY config config
remote:  ---> 5ac08e894b10
remote: Step 9/25 : RUN mix deps.get
remote:  ---> Running in 161800382fd6
remote: ** (RuntimeError) environment variable DATABASE_URL is missing.
remote: For example: ecto://USER:PASS@HOST/DATABASE
remote: 
remote:     (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
remote:     (stdlib) erl_eval.erl:449: :erl_eval.expr/5
remote:     (stdlib) erl_eval.erl:126: :erl_eval.exprs/5
remote:     (elixir) lib/code.ex:240: Code.eval_string/3
remote:     (mix) lib/mix/config.ex:158: anonymous fn/2 in Mix.Config.__import__!/2
remote:     (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
remote:     (mix) lib/mix/config.ex:157: Mix.Config.__import__!/2
remote: The command '/bin/sh -c mix deps.get' returned a non-zero code: 1
remote: 
remote: Verifying deploy...
remote: 
remote: !	Push rejected to serene-tor-13468.
remote: 
To https://git.heroku.com/serene-tor-13468.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/serene-tor-13468.git'

Showing Posts 1 to 6

perzanko

perzanko

Have you set up database on your Heroku app? ‘DATABASE_URL is missing’ means that you haven’t exported the environment variable. You probably didn’t add a database as addon on Heroku.

If you use postgres, here is the tutorial how to do it: Heroku Postgres | Heroku Dev Center

biske

biske OP

Yes, that is covered in this part:
https://github.com/phoenixframework/phoenix/blob/master/guides/deployment/heroku.md#creating-environment-variables-in-heroku

To prove that database url is set I tried (I changed the values of course):

Apples-MacBook-Pro:hello ivanbisevac$ heroku config
=== serene-tor-13468 Config Vars
DATABASE_URL:    postgres://jbkhmewallortj:b44a50b8b938221a9caccbae04622bbf58bbcd60e894d2a309ece17259f2db1a@ec2-174-129-227-80.compute-1.amazonaws.com:5432/de34tt303335l8
POOL_SIZE:       18
SECRET_KEY_BASE: cWV2XTCuO0S4p7+jKdXXLYX9XQn8CzI1vVAW0g34smrV3lkAONjOQRmzv9QIarB

Seems like heroku is not exposing those variables in the build time. Probably heroku.yml from the tutorial is wrong.

perzanko

perzanko

Hmm. The issue could be related to docker. Try use this buildpack instead: GitHub - HashNuke/heroku-buildpack-elixir: Heroku Buildpack for Elixir with nitro boost · GitHub

biske

biske OP

That’s ok, but my question is not about buildpack deploy, but container one. Whole point is that there is Phoenix documentation how to deploy which doesn’t work.

outlog

outlog

think the issue will be solved if you complete these steps: phoenix/guides/deployment/releases.md at main · phoenixframework/phoenix · GitHub

caike

caike

Make sure the environment variables are created in Heroku, then add the following two lines to the top of the Dockerfile:

ARG DATABASE_URL
ARG SECRET_KEY_BASE
— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews