fix DATABASE_URL config in phoenix

This commit is contained in:
Tao Bror Bojlén 2019-07-14 14:40:54 +01:00
parent f292d09b01
commit b8c474ca89
No known key found for this signature in database
GPG key ID: C6EC7AAB905F9E6F
5 changed files with 14 additions and 38 deletions

View file

@ -16,9 +16,9 @@ ENV MIX_ENV=prod
# install mix dependencies # install mix dependencies
COPY mix.exs mix.lock ./ COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get RUN mix deps.get
RUN mix deps.compile RUN mix deps.compile
COPY config config
# build assets # build assets
# COPY assets assets # COPY assets assets

View file

@ -3,17 +3,16 @@
import Config import Config
# For production, don't forget to configure the url host ssl =
# to something meaningful, Phoenix uses this information case System.get_env("MIX_ENV") do
# when generating URLs. "prod" -> true
_ -> false
end
config :backend, Backend.Repo, config :backend, Backend.Repo,
# username: System.get_env("POSTGRES_USER"), url: System.get_env("DATABASE_URL"),
# password: System.get_env("POSTGRES_PASSWORD"),
# database: System.get_env("POSTGRES_DB"),
# hostname: System.get_env("POSTGRES_HOSTNAME"),
url: System.get_env("ecto://" <> "DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
ssl: true ssl: ssl
# show_sensitive_data_on_connection_error: true # show_sensitive_data_on_connection_error: true

View file

@ -1,6 +1,7 @@
defmodule Backend.Crawler.Crawlers.Mastodon do defmodule Backend.Crawler.Crawlers.Mastodon do
require Logger require Logger
import Backend.Crawler.Util import Backend.Crawler.Util
import Backend.Util
alias Backend.Crawler.ApiCrawler alias Backend.Crawler.ApiCrawler
@behaviour ApiCrawler @behaviour ApiCrawler

View file

@ -2,4 +2,8 @@ defmodule Backend.Repo do
use Ecto.Repo, use Ecto.Repo,
otp_app: :backend, otp_app: :backend,
adapter: Ecto.Adapters.Postgres adapter: Ecto.Adapters.Postgres
def init(_type, config) do
{:ok, Keyword.put(config, :url, System.get_env("DATABASE_URL"))}
end
end end

View file

@ -1,28 +0,0 @@
version: "3"
services:
db:
restart: always
networks:
- database_network
phoenix:
restart: always
build: ./backend
networks:
- database_network
depends_on:
- db
ports:
- "${PORT}:${PORT}"
environment:
- DATABASE_URL
- SECRET_KEY_BASE
- PORT
- BACKEND_HOSTNAME
gephi:
networks:
- database_network
depends_on:
- db
networks:
database_network:
driver: bridge