From 83975a0918b223eb04db4e657bc4e2234d809fa0 Mon Sep 17 00:00:00 2001 From: Raphael Maenle Date: Tue, 11 Jan 2022 13:52:30 +0100 Subject: [PATCH] updates production services for server --- config/dev.exs | 2 +- config/prod.exs | 22 ++++++++++++++++++++-- config/runtime.exs | 4 ++-- index.html | 1 + 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 index.html diff --git a/config/dev.exs b/config/dev.exs index 6b69e13..c7fb30a 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -19,7 +19,7 @@ config :bump, Bump.Repo, config :bump, BumpWeb.Endpoint, # Binding to loopback ipv4 address prevents access from other machines. # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. - http: [ip: {0, 0, 0, 0}, port: 4000], + http: [ip: {0, 0, 0, 0}, port: 4012], check_origin: false, code_reloader: true, debug_errors: true, diff --git a/config/prod.exs b/config/prod.exs index 537383f..9db466c 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,5 +1,15 @@ import Config +# Configure your database +config :bump, Bump.Repo, + username: "postgres", + password: "postgres", + database: "bump_dev", + hostname: "database", + port: 5555, + show_sensitive_data_on_connection_error: false, + pool_size: 10 + # For production, don't forget to configure the url host # to something meaningful, Phoenix uses this information # when generating URLs. @@ -10,8 +20,16 @@ import Config # which you should run after static files are built and # before starting your production server. config :bump, BumpWeb.Endpoint, - url: [host: "example.com", port: 80], - cache_static_manifest: "priv/static/cache_manifest.json" + http: [ip: {0, 0, 0, 0}, port: 4012], + check_origin: false, + code_reloader: false, + debug_errors: false, + cache_static_manifest: "priv/static/cache_manifest.json", + secret_key_base: "c/uw9+syw3QefW2JeS+JzMihBKTfVB6C4d/9cmStSynygaP91BLoxbPVedBJIU6p", + watchers: [ + # Start the esbuild watcher by calling Esbuild.install_and_run(:default, args) + esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]} + ] # Do not print debug messages in production config :logger, level: :info diff --git a/config/runtime.exs b/config/runtime.exs index b00b1fc..a0f49d4 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -6,7 +6,7 @@ import Config # and secrets from environment variables or elsewhere. Do not define # any compile-time configuration in here, as it won't be applied. # The block below contains prod specific runtime configuration. -if config_env() == :prod do +if config_env() == :nothing do database_url = System.get_env("DATABASE_URL") || raise """ @@ -39,7 +39,7 @@ if config_env() == :prod do # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html # for details about using IPv6 vs IPv4 and loopback vs public addresses. ip: {0, 0, 0, 0, 0, 0, 0, 0}, - port: String.to_integer(System.get_env("PORT") || "4000") + port: String.to_integer(System.get_env("PORT") || "4012") ], secret_key_base: secret_key_base diff --git a/index.html b/index.html new file mode 100644 index 0000000..a01bb3d --- /dev/null +++ b/index.html @@ -0,0 +1 @@ +Bump API \ No newline at end of file