From baec4ab275987a6b86822938c98bbfd99b835279 Mon Sep 17 00:00:00 2001 From: rudresh Date: Wed, 13 May 2020 01:27:22 +0530 Subject: [PATCH 01/44] Beanstalk basic setup --- .DS_Store | Bin 0 -> 6148 bytes .gitignore | 6 +++++- Dockerrun.aws.json | 13 +++++++++++++ config/test.exs | 10 ++++++---- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 .DS_Store create mode 100644 Dockerrun.aws.json diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Wed, 13 May 2020 01:42:03 +0530 Subject: [PATCH 02/44] updated image version --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 713c7a18..3e7f8a97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM elixir:1.9-alpine as build +FROM elixir:1.10-alpine as build # MAINTAINER tech@coloredcow.com # install build dependencies @@ -36,7 +36,7 @@ RUN mix compile RUN mix release # prepare release image -FROM alpine:3.9 AS app +FROM alpine:3.11 AS app # install runtime dependencies RUN apk add --update bash openssl postgresql-client From 8341bef3510649e5e78dad15d0966315234c285c Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 01:30:24 +0530 Subject: [PATCH 03/44] updated the dockerrun version --- Dockerrun.aws.json | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index 9fd72d05..253ce6ba 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -1,13 +1,30 @@ { - "AWSEBDockerrunVersion": "1", - "Image": { - "Name": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", - "Update": "true" - }, - "Ports": [ - { - "HostPort": "80", - "ContainerPort": "4000" - } + "AWSEBDockerrunVersion": 2, + "containerDefinitions": [ + { + "name": "app", + "image": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", + "memory": 128, + "portMappings": [ + { + "hostPort": 80, + "containerPort": 4000 + } + ], + "links": [ + "db" + ] + }, + { + "name": "db", + "image": "postgres:10-alpine", + "memory": 128, + "portMappings": [ + { + "hostPort": 5432, + "containerPort": 5432 + } + ] + } ] - } \ No newline at end of file +} \ No newline at end of file From 1eafb900a9e1991a009ab33c453116c0bc03d1ce Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 01:50:39 +0530 Subject: [PATCH 04/44] Updated dockerfile --- Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3e7f8a97..d432e5de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,14 +45,14 @@ EXPOSE 4000 ENV MIX_ENV=prod # prepare app directory -RUN mkdir /app -WORKDIR /app +RUN mkdir /prod +WORKDIR /prod -# copy release to app container -COPY --from=build /app/_build/prod/rel/project_tides . +# copy release to prod container +COPY --from=build /prod/_build/prod/rel/project_tides . COPY build_scripts/entrypoint.sh . -RUN chown -R nobody: /app +RUN chown -R nobody: /prod USER nobody -ENV HOME=/app -CMD ["bash", "/app/entrypoint.sh"] \ No newline at end of file +ENV HOME=/prod +CMD ["bash", "/prod/entrypoint.sh"] \ No newline at end of file From 8f244c719e1fee7f0cfb7b7a3d25819003c3aecc Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 02:00:26 +0530 Subject: [PATCH 05/44] updated dockerrun --- Dockerrun.aws.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index 253ce6ba..b119f637 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -5,6 +5,11 @@ "name": "app", "image": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", "memory": 128, + "command": [ + "tail", + "-f", + "/bin/bash" + ], "portMappings": [ { "hostPort": 80, @@ -19,6 +24,11 @@ "name": "db", "image": "postgres:10-alpine", "memory": 128, + "command": [ + "tail", + "-f", + "/bin/bash" + ], "portMappings": [ { "hostPort": 5432, From 95472b80d7fac79ca149bc394d49e3e1ffbb2934 Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 02:19:12 +0530 Subject: [PATCH 06/44] port changed --- Dockerrun.aws.json | 2 +- docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index b119f637..bc0d0d6d 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -12,7 +12,7 @@ ], "portMappings": [ { - "hostPort": 80, + "hostPort": 4000, "containerPort": 4000 } ], diff --git a/docker-compose.yml b/docker-compose.yml index 0e7a36e7..080e2e63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,13 +13,13 @@ services: - DATABASE_PASSWORD=${DATABASE_PASSWORD} - BASE_URL=${BASE_URL} ports: - - 80:4000 + - 4000:4000 depends_on: - db db: image: postgres:10-alpine ports: - - 5460:5432 + - 5432:5432 volumes: - ./docker-volumes/postgresql:/var/lib/postgresql - ./build_scripts/pg:/docker-entrypoint-initdb.d From eaa65c5315ae6a973b34fd203c357785533d6439 Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 15:05:08 +0530 Subject: [PATCH 07/44] updated ports --- Dockerfile | 14 +++++++------- Dockerrun.aws.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index d432e5de..2ecde954 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,14 +45,14 @@ EXPOSE 4000 ENV MIX_ENV=prod # prepare app directory -RUN mkdir /prod -WORKDIR /prod +RUN mkdir /app +WORKDIR /app -# copy release to prod container -COPY --from=build /prod/_build/prod/rel/project_tides . +# copy release to app container +COPY --from=build /app/_build/app/rel/project_tides . COPY build_scripts/entrypoint.sh . -RUN chown -R nobody: /prod +RUN chown -R nobody: /app USER nobody -ENV HOME=/prod -CMD ["bash", "/prod/entrypoint.sh"] \ No newline at end of file +ENV HOME=/app +CMD ["bash", "/app/entrypoint.sh"] \ No newline at end of file diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index bc0d0d6d..b119f637 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -12,7 +12,7 @@ ], "portMappings": [ { - "hostPort": 4000, + "hostPort": 80, "containerPort": 4000 } ], From 963227c7e0fd9196eadb31ae9f1edfbe358c758d Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 15:21:51 +0530 Subject: [PATCH 08/44] added networks --- docker-compose.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 080e2e63..5617ee77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,9 @@ version: "3" +networks: + internal: + external: false + services: app: image: project_tides:0.1.0 @@ -16,6 +20,8 @@ services: - 4000:4000 depends_on: - db + networks: + internal: db: image: postgres:10-alpine ports: @@ -30,4 +36,6 @@ services: - POSTGRES_MULTIPLE_DATABASES=${POSTGRES_MULTIPLE_DATABASES} - DATABASE_ROLE=${DATABASE_ROLE} - DATABASE_HOST=${DATABASE_HOST} + networks: + internal: From b939a4a2669d93ffa178fc58681f8d3788c4c907 Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 23:48:33 +0530 Subject: [PATCH 09/44] port changed --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5617ee77..9a6a42b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: - DATABASE_PASSWORD=${DATABASE_PASSWORD} - BASE_URL=${BASE_URL} ports: - - 4000:4000 + - 80:4000 depends_on: - db networks: From e09b36be1b153e44a13588794e5b4be34cc9f1c8 Mon Sep 17 00:00:00 2001 From: rudresh Date: Thu, 14 May 2020 23:55:02 +0530 Subject: [PATCH 10/44] modified dockerfiles --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2ecde954..3e7f8a97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,7 @@ RUN mkdir /app WORKDIR /app # copy release to app container -COPY --from=build /app/_build/app/rel/project_tides . +COPY --from=build /app/_build/prod/rel/project_tides . COPY build_scripts/entrypoint.sh . RUN chown -R nobody: /app USER nobody From 78cd3766bf8de33b24b7149b063e4f97c9ffe9ea Mon Sep 17 00:00:00 2001 From: rudresh Date: Fri, 15 May 2020 00:57:01 +0530 Subject: [PATCH 11/44] added logs --- config/releases.exs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/releases.exs b/config/releases.exs index 27d9b7a7..fc24d42d 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -4,10 +4,13 @@ db_host = System.get_env("DATABASE_HOST") || raise """ environment variable DATABASE_HOST is missing. """ -db_database = System.get_env("DATABASE_DB") || "postgres" +db_database = System.get_env("DATABASE_DB") || "db" db_username = System.get_env("DATABASE_USER") || "postgres" db_password = System.get_env("DATABASE_PASSWORD") || "postgres" db_url = "ecto://#{db_username}:#{db_password}@#{db_host}/#{db_database}" + +IO.puts "You forgot to give me #{db_url}" + config :project_tides, ProjectTides.Repo, url: db_url, pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), From c5715ecd84157f218b310e03395db0cc1e8a2f2c Mon Sep 17 00:00:00 2001 From: rudresh Date: Fri, 15 May 2020 01:36:24 +0530 Subject: [PATCH 12/44] modified docker compose file --- docker-compose.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9a6a42b0..ad2243b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,12 +28,13 @@ services: - 5432:5432 volumes: - ./docker-volumes/postgresql:/var/lib/postgresql - - ./build_scripts/pg:/docker-entrypoint-initdb.d + # - ./build_scripts/pg:/docker-entrypoint-initdb.d environment: # - POSTGRES_DB=${DATABASE_DB} - POSTGRES_USER=${DATABASE_USER} - POSTGRES_PASSWORD=${DATABASE_PASSWORD} - - POSTGRES_MULTIPLE_DATABASES=${POSTGRES_MULTIPLE_DATABASES} + # - POSTGRES_MULTIPLE_DATABASES=${POSTGRES_MULTIPLE_DATABASES} + - POSTGRES_DB={DATABASE_DB} - DATABASE_ROLE=${DATABASE_ROLE} - DATABASE_HOST=${DATABASE_HOST} networks: From 97d9c4c9f0d512dfcd19a5d223f6c84d73efff45 Mon Sep 17 00:00:00 2001 From: rudresh Date: Fri, 15 May 2020 01:48:21 +0530 Subject: [PATCH 13/44] updated network name --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ad2243b7..c395da09 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,8 @@ version: "3" networks: - internal: - external: false + - tides_nw + services: app: @@ -21,7 +21,7 @@ services: depends_on: - db networks: - internal: + - tides_nw db: image: postgres:10-alpine ports: @@ -38,5 +38,5 @@ services: - DATABASE_ROLE=${DATABASE_ROLE} - DATABASE_HOST=${DATABASE_HOST} networks: - internal: + - tides_nw From 667dced25fbec2e5eed646d50eeb2c4a39a9b4d8 Mon Sep 17 00:00:00 2001 From: rudresh Date: Fri, 15 May 2020 14:30:16 +0530 Subject: [PATCH 14/44] added ebextensions --- .ebextensions/environment.config | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .ebextensions/environment.config diff --git a/.ebextensions/environment.config b/.ebextensions/environment.config new file mode 100644 index 00000000..2882773d --- /dev/null +++ b/.ebextensions/environment.config @@ -0,0 +1,17 @@ +option_settings: + - option_name: BASE_URL + value: tides.coloredcow.com + - option_name: DATABASE_USER + value: user1 + - option_name: DATABASE_PASSWORD + value: pass1 + - option_name: POSTGRES_MULTIPLE_DATABASES + value: main_db,test_db + - option_name: DATABASE_DB + value: main_db + - option_name: DATABASE_ROLE + value: db + - option_name: DATABASE_HOST + value: main_db + - option_name: SECRET_KEY_BASE + value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 \ No newline at end of file From 60cbc23c1d08af91c38ffb19fd94b86558d34f59 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sat, 16 May 2020 19:05:37 +0530 Subject: [PATCH 15/44] updated test db --- config/test.exs | 2 +- docker-compose.yml => docker-compose.yml.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename docker-compose.yml => docker-compose.yml.1 (96%) diff --git a/config/test.exs b/config/test.exs index 2ad20147..549741e3 100644 --- a/config/test.exs +++ b/config/test.exs @@ -9,7 +9,7 @@ config :project_tides, ProjectTides.Repo, username: "user1", password: "pass1", # database: "project_tides_test#{System.get_env("MIX_TEST_PARTITION")}", - database: "test_db", + database: "testdb", hostname: "localhost", pool: Ecto.Adapters.SQL.Sandbox, port: 5460 diff --git a/docker-compose.yml b/docker-compose.yml.1 similarity index 96% rename from docker-compose.yml rename to docker-compose.yml.1 index c395da09..67cfbf9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml.1 @@ -35,7 +35,7 @@ services: - POSTGRES_PASSWORD=${DATABASE_PASSWORD} # - POSTGRES_MULTIPLE_DATABASES=${POSTGRES_MULTIPLE_DATABASES} - POSTGRES_DB={DATABASE_DB} - - DATABASE_ROLE=${DATABASE_ROLE} + # - DATABASE_ROLE=${DATABASE_ROLE} - DATABASE_HOST=${DATABASE_HOST} networks: - tides_nw From 0e3dc4650a47ad1688151d6532148eedad22830c Mon Sep 17 00:00:00 2001 From: rudresh Date: Sat, 16 May 2020 19:48:07 +0530 Subject: [PATCH 16/44] updated aws docker configs --- .ebextensions/environment.config | 20 +++++------ Dockerrun.aws.json | 57 +++++++++++--------------------- build_scripts/entrypoint.sh | 16 ++++----- 3 files changed, 37 insertions(+), 56 deletions(-) diff --git a/.ebextensions/environment.config b/.ebextensions/environment.config index 2882773d..c3671f16 100644 --- a/.ebextensions/environment.config +++ b/.ebextensions/environment.config @@ -2,16 +2,14 @@ option_settings: - option_name: BASE_URL value: tides.coloredcow.com - option_name: DATABASE_USER - value: user1 + value: postgres - option_name: DATABASE_PASSWORD - value: pass1 - - option_name: POSTGRES_MULTIPLE_DATABASES - value: main_db,test_db - - option_name: DATABASE_DB - value: main_db - - option_name: DATABASE_ROLE - value: db - - option_name: DATABASE_HOST - value: main_db + value: postgres + - option_name: POSTGRES_DB + value: tidesdb - option_name: SECRET_KEY_BASE - value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 \ No newline at end of file + value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 + - option_name: DATABASE_HOST + value: tidesdb.czpgx5pis6ka.ap-south-1.rds.amazonaws.com + - option_name: DATABASE_DB + value: tidesdb \ No newline at end of file diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index b119f637..ad353f96 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -1,40 +1,23 @@ { - "AWSEBDockerrunVersion": 2, - "containerDefinitions": [ - { - "name": "app", - "image": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", - "memory": 128, - "command": [ - "tail", - "-f", - "/bin/bash" - ], - "portMappings": [ - { - "hostPort": 80, - "containerPort": 4000 - } - ], - "links": [ - "db" - ] - }, - { - "name": "db", - "image": "postgres:10-alpine", - "memory": 128, - "command": [ - "tail", - "-f", - "/bin/bash" - ], - "portMappings": [ - { - "hostPort": 5432, - "containerPort": 5432 - } - ] + "AWSEBDockerrunVersion": 1, + "volumes": [ + { + "name": "app", + "host": { + "sourcePath": "/app" } + } + ], + "containerDefinitions": [ + { + "name": "app", + "essential": true, + "portMappings": [ + { + "hostPort": 80, + "containerPort": 4000 + } + ] + } ] -} \ No newline at end of file + } diff --git a/build_scripts/entrypoint.sh b/build_scripts/entrypoint.sh index 19d53e1a..aabb6eb1 100755 --- a/build_scripts/entrypoint.sh +++ b/build_scripts/entrypoint.sh @@ -2,15 +2,15 @@ # docker entrypoint script. # assign a default for the database_user / role -DB_ROLE=${DATABASE_ROLE:-postgres} -DB_HOST=${DATABASE_HOST:-db} +# DB_ROLE=${DATABASE_ROLE:-postgres} +# DB_HOST=${DATABASE_HOST:-db} -# wait until Postgres is ready -while ! pg_isready -q -h $DB_HOST -p 5432 -U $DB_ROLE -do - echo "$(date) - waiting for database to start" - sleep 2 -done +# # wait until Postgres is ready +# while ! pg_isready -q -h $DB_HOST -p 5432 -U $DB_ROLE +# do +# echo "$(date) - waiting for database to start" +# sleep 2 +# done bin="/app/bin/project_tides" eval "$bin eval \"ProjectTides.Release.migrate\"" From 02a7d450bcb48b686bfd220edffcdeeba47b1db4 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 01:05:48 +0530 Subject: [PATCH 17/44] update the config for multi-docker --- Dockerrun.aws.json | 53 +++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index ad353f96..31f139ab 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -1,23 +1,36 @@ { - "AWSEBDockerrunVersion": 1, - "volumes": [ - { - "name": "app", - "host": { - "sourcePath": "/app" - } - } - ], + "AWSEBDockerrunVersion": 2, "containerDefinitions": [ - { - "name": "app", - "essential": true, - "portMappings": [ - { - "hostPort": 80, - "containerPort": 4000 - } - ] - } + { + "name": "app", + "image": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", + "memory": 128, + "command": [ + "tail", + "-f", + "/bin/bash" + ], + "portMappings": [ + { + "hostPort": 80, + "containerPort": 4000 + } + ], + "links": [ + "build" + ] + }, + { + "name": "build", + "image": "alpine:3.11", + "memory": 128, + "essential": true, + "portMappings": [ + { + "hostPort": 80, + "containerPort": 4000 + } + ] + } ] - } +} \ No newline at end of file From 4fb4b070baf7beceebe5d2cec33fde1c523c8187 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 01:27:27 +0530 Subject: [PATCH 18/44] moved back to version 1 --- Dockerrun.aws.json | 53 +++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index 31f139ab..f9cbfe89 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -1,36 +1,23 @@ { - "AWSEBDockerrunVersion": 2, - "containerDefinitions": [ - { - "name": "app", - "image": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", - "memory": 128, - "command": [ - "tail", - "-f", - "/bin/bash" - ], - "portMappings": [ - { - "hostPort": 80, - "containerPort": 4000 - } - ], - "links": [ - "build" - ] - }, - { - "name": "build", - "image": "alpine:3.11", - "memory": 128, - "essential": true, - "portMappings": [ - { - "hostPort": 80, - "containerPort": 4000 - } - ] + "AWSEBDockerrunVersion": 1, + "volumes": [ + { + "name": "app", + "host": { + "sourcePath": "/app" } + } + ], + "containerDefinitions": [ + { + "name": "app", + "essential": true, + "portMappings": [ + { + "hostPort": 80, + "containerPort": 4000 + } + ] + } ] -} \ No newline at end of file + } \ No newline at end of file From ab0715e2216e9d81e24774478c50c114e62efef0 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 01:37:18 +0530 Subject: [PATCH 19/44] made change to see dashboard --- lib/project_tides_web/router.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/project_tides_web/router.ex b/lib/project_tides_web/router.ex index ca373ae2..ffad5b0d 100644 --- a/lib/project_tides_web/router.ex +++ b/lib/project_tides_web/router.ex @@ -16,12 +16,12 @@ defmodule ProjectTidesWeb.Router do # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). - if Mix.env() in [:dev, :test] do + # if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through [:fetch_session, :protect_from_forgery] live_dashboard "/dashboard", metrics: ProjectTidesWeb.Telemetry end - end + # end end From 434bb05346eab9962f1c8db7b570a4f882aa61a3 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 12:23:03 +0530 Subject: [PATCH 20/44] added buildspec --- buildspec.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000..7e691133 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,35 @@ +# buildspec.yml +version: 0.2 + +phases: + + pre_build: + commands: + - echo Logging in to Amazon ECR. + - aws --version + - $(aws ecr get-login --no-include-email --region ap-south-1) + - REPOSITORY_URI=023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides + - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) + - IMAGE_TAG=${COMMIT_HASH:=latest} + build: + commands: + - echo Build started on `date` + # - npm run build + # - npm run test + # - npm run migrate + # - npm run test:e2e + - docker build -t $REPOSITORY_URI:latest . + - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG + post_build: + commands: + - echo Build completed on `date` + - echo Pushing the Docker images... + - docker push $REPOSITORY_URI:latest + - docker push $REPOSITORY_URI:$IMAGE_TAG +# cache: +# paths: +# - 'node_modules/**/*' +artifacts: + files: + - '**/*' + name: project-tides-$(date +%Y-%m-%d) \ No newline at end of file From 66822355580ba8b452082424fa8c3f1dd599027a Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 12:23:03 +0530 Subject: [PATCH 21/44] added buildspec --- buildspec.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000..2e9ba62c --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,36 @@ +# buildspec.yml +version: 0.2 + +phases: + + pre_build: + commands: + - echo Logging in to Amazon ECR. + - aws --version + # - $(aws ecr get-login --no-include-email --region ap-south-1) + - $(aws ecr get-login-password --region ap-south-1) + - REPOSITORY_URI=023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides + - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) + - IMAGE_TAG=${COMMIT_HASH:=latest} + build: + commands: + - echo Build started on `date` + # - npm run build + # - npm run test + # - npm run migrate + # - npm run test:e2e + - docker build -t $REPOSITORY_URI:latest . + - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG + post_build: + commands: + - echo Build completed on `date` + - echo Pushing the Docker images... + - docker push $REPOSITORY_URI:latest + - docker push $REPOSITORY_URI:$IMAGE_TAG +# cache: +# paths: +# - 'node_modules/**/*' +artifacts: + files: + - '**/*' + name: project-tides-$(date +%Y-%m-%d) \ No newline at end of file From 892356f37838e777b4c9baeea62475511e4dcb5d Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 12:35:40 +0530 Subject: [PATCH 22/44] updated buildspec --- buildspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 2e9ba62c..ee5b89d2 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -7,7 +7,6 @@ phases: commands: - echo Logging in to Amazon ECR. - aws --version - # - $(aws ecr get-login --no-include-email --region ap-south-1) - $(aws ecr get-login-password --region ap-south-1) - REPOSITORY_URI=023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) From 7af96a416bdef9c22bdc8f81d1877ca7116dfaba Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 13:08:03 +0530 Subject: [PATCH 23/44] updated for ecr-login --- buildspec.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index ba5f67d1..0d9c03c5 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -2,11 +2,13 @@ version: 0.2 phases: + pre_build: commands: - echo Logging in to Amazon ECR. - aws --version - - $(aws ecr get-login-password --region ap-south-1) + # - $(aws ecr get-login --no-include-email --region ap-south-1) + - $(aws ecr get-login --region ap-south-1) - REPOSITORY_URI=023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - IMAGE_TAG=${COMMIT_HASH:=latest} From e11ec018a38d661e61e79c857f1bf11d490bc402 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 14:02:44 +0530 Subject: [PATCH 24/44] buildspec updated --- buildspec.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index 0d9c03c5..ffa468b3 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -7,8 +7,8 @@ phases: commands: - echo Logging in to Amazon ECR. - aws --version - # - $(aws ecr get-login --no-include-email --region ap-south-1) - - $(aws ecr get-login --region ap-south-1) + - $(aws ecr get-login --no-include-email --region ap-south-1) + # - $(aws ecr get-login --region ap-south-1) - REPOSITORY_URI=023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - IMAGE_TAG=${COMMIT_HASH:=latest} From d13b4b3cbaeb39d6550324b30df89e4aff1a5cb1 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 14:13:56 +0530 Subject: [PATCH 25/44] test commit for codepipeline --- lib/project_tides_web/router.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/project_tides_web/router.ex b/lib/project_tides_web/router.ex index ffad5b0d..ca373ae2 100644 --- a/lib/project_tides_web/router.ex +++ b/lib/project_tides_web/router.ex @@ -16,12 +16,12 @@ defmodule ProjectTidesWeb.Router do # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). - # if Mix.env() in [:dev, :test] do + if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through [:fetch_session, :protect_from_forgery] live_dashboard "/dashboard", metrics: ProjectTidesWeb.Telemetry end - # end + end end From 7bd1b5bf7481f27f7ff7a7344f681532ecf762c6 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 15:10:08 +0530 Subject: [PATCH 26/44] dashboard test --- lib/project_tides_web/router.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/project_tides_web/router.ex b/lib/project_tides_web/router.ex index ca373ae2..ffad5b0d 100644 --- a/lib/project_tides_web/router.ex +++ b/lib/project_tides_web/router.ex @@ -16,12 +16,12 @@ defmodule ProjectTidesWeb.Router do # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). - if Mix.env() in [:dev, :test] do + # if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through [:fetch_session, :protect_from_forgery] live_dashboard "/dashboard", metrics: ProjectTidesWeb.Telemetry end - end + # end end From 24c37122c36150d3c648d4e50929d97edfc6bb34 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 17:58:11 +0530 Subject: [PATCH 27/44] updated for ecr image --- Dockerrun.aws.json | 28 +++++++++------------------- buildspec.yml | 7 +------ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index f9cbfe89..6da0f515 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -1,23 +1,13 @@ { "AWSEBDockerrunVersion": 1, - "volumes": [ - { - "name": "app", - "host": { - "sourcePath": "/app" + "Image": { + "Name": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", + "Update": "true" + }, + "Ports": [ + { + "HostPort": "80", + "ContainerPort": "4000" } - } - ], - "containerDefinitions": [ - { - "name": "app", - "essential": true, - "portMappings": [ - { - "hostPort": 80, - "containerPort": 4000 - } - ] - } - ] + ] } \ No newline at end of file diff --git a/buildspec.yml b/buildspec.yml index ffa468b3..a76e3519 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -8,17 +8,12 @@ phases: - echo Logging in to Amazon ECR. - aws --version - $(aws ecr get-login --no-include-email --region ap-south-1) - # - $(aws ecr get-login --region ap-south-1) - REPOSITORY_URI=023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - IMAGE_TAG=${COMMIT_HASH:=latest} build: commands: - echo Build started on `date` - # - npm run build - # - npm run test - # - npm run migrate - # - npm run test:e2e - docker build -t $REPOSITORY_URI:latest . - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG post_build: @@ -29,7 +24,7 @@ phases: - docker push $REPOSITORY_URI:$IMAGE_TAG # cache: # paths: -# - 'node_modules/**/*' +# - '/**/*' - update as needed artifacts: files: - '**/*' From 048d2e370024a95eb47147775a0b7bf0b875b378 Mon Sep 17 00:00:00 2001 From: rudresh Date: Sun, 17 May 2020 18:07:49 +0530 Subject: [PATCH 28/44] updated release config file --- config/releases.exs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/releases.exs b/config/releases.exs index fc24d42d..897075ad 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -22,6 +22,4 @@ secret_key_base = System.get_env("SECRET_KEY_BASE") || """ config :project_tides, ProjectTidesWeb.Endpoint, server: true, - http: [:inet6, port: 4000], - secret_key_base: secret_key_base, - url: [host: System.get_env("BASE_URL"), port: 80] \ No newline at end of file + http: [:inet6, port: 4000] \ No newline at end of file From 7d551fde5d5ef5bcb1488faf8bad5b228757c380 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Thu, 21 May 2020 01:04:52 +0530 Subject: [PATCH 29/44] Added eb env config file to gitignor --- .ebextensions/environment.config | 15 --------------- .gitignore | 2 ++ config/releases.exs | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 .ebextensions/environment.config diff --git a/.ebextensions/environment.config b/.ebextensions/environment.config deleted file mode 100644 index c3671f16..00000000 --- a/.ebextensions/environment.config +++ /dev/null @@ -1,15 +0,0 @@ -option_settings: - - option_name: BASE_URL - value: tides.coloredcow.com - - option_name: DATABASE_USER - value: postgres - - option_name: DATABASE_PASSWORD - value: postgres - - option_name: POSTGRES_DB - value: tidesdb - - option_name: SECRET_KEY_BASE - value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 - - option_name: DATABASE_HOST - value: tidesdb.czpgx5pis6ka.ap-south-1.rds.amazonaws.com - - option_name: DATABASE_DB - value: tidesdb \ No newline at end of file diff --git a/.gitignore b/.gitignore index a64f59e8..b9c5d455 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,7 @@ project_tides-*.tar .elasticbeanstalk/* !.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.global.yml +.ebextensions/environment.config + config/dev.exs .DS_Store diff --git a/config/releases.exs b/config/releases.exs index 5793e51b..a3e039db 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -6,7 +6,7 @@ db_host = System.get_env("DATABASE_HOST") || raise """ environment variable DATABASE_HOST is missing. """ -db_database = System.get_env("DATABASE_DB") || "db" +db_database = System.get_env("DATABASE_DB") || "postgres" db_username = System.get_env("DATABASE_USER") || "postgres" db_password = System.get_env("DATABASE_PASSWORD") || "postgres" db_url = "ecto://#{db_username}:#{db_password}@#{db_host}/#{db_database}" From b32e328113f83ac933de732499b4def91a404693 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Thu, 21 May 2020 01:14:27 +0530 Subject: [PATCH 30/44] Config changes --- config/releases.exs | 2 -- config/test.exs | 8 +++----- lib/project_tides_web/router.ex | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/config/releases.exs b/config/releases.exs index a3e039db..e265d0c6 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -11,8 +11,6 @@ db_username = System.get_env("DATABASE_USER") || "postgres" db_password = System.get_env("DATABASE_PASSWORD") || "postgres" db_url = "ecto://#{db_username}:#{db_password}@#{db_host}/#{db_database}" -IO.puts "You forgot to give me #{db_url}" - config :project_tides, ProjectTides.Repo, url: db_url, pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), diff --git a/config/test.exs b/config/test.exs index 549741e3..57fad02f 100644 --- a/config/test.exs +++ b/config/test.exs @@ -6,13 +6,11 @@ use Mix.Config # to provide built-in test partitioning in CI environment. # Run `mix help test` for more information. config :project_tides, ProjectTides.Repo, - username: "user1", - password: "pass1", - # database: "project_tides_test#{System.get_env("MIX_TEST_PARTITION")}", - database: "testdb", + username: "postgres", + password: "postgres", + database: "project_tides_test#{System.get_env("MIX_TEST_PARTITION")}", hostname: "localhost", pool: Ecto.Adapters.SQL.Sandbox, - port: 5460 # We don't run a server during test. If one is required, # you can enable the server option below. diff --git a/lib/project_tides_web/router.ex b/lib/project_tides_web/router.ex index ffad5b0d..ca373ae2 100644 --- a/lib/project_tides_web/router.ex +++ b/lib/project_tides_web/router.ex @@ -16,12 +16,12 @@ defmodule ProjectTidesWeb.Router do # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). - # if Mix.env() in [:dev, :test] do + if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through [:fetch_session, :protect_from_forgery] live_dashboard "/dashboard", metrics: ProjectTidesWeb.Telemetry end - # end + end end From db3825ec984c370587b58f519b750a166b3d4072 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Thu, 21 May 2020 01:25:15 +0530 Subject: [PATCH 31/44] CI failure fix --- config/test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/test.exs b/config/test.exs index 57fad02f..a3f862c0 100644 --- a/config/test.exs +++ b/config/test.exs @@ -10,7 +10,7 @@ config :project_tides, ProjectTides.Repo, password: "postgres", database: "project_tides_test#{System.get_env("MIX_TEST_PARTITION")}", hostname: "localhost", - pool: Ecto.Adapters.SQL.Sandbox, + pool: Ecto.Adapters.SQL.Sandbox # We don't run a server during test. If one is required, # you can enable the server option below. From bcc4aee33a82621a20303991740b8f341e06b2a5 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Sun, 24 May 2020 15:02:30 +0530 Subject: [PATCH 32/44] Removed .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Mon, 25 May 2020 13:23:25 +0530 Subject: [PATCH 33/44] EB build check --- .ebextensions/environment.config | 15 +++++++++++++++ .gitignore | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .ebextensions/environment.config diff --git a/.ebextensions/environment.config b/.ebextensions/environment.config new file mode 100644 index 00000000..c3671f16 --- /dev/null +++ b/.ebextensions/environment.config @@ -0,0 +1,15 @@ +option_settings: + - option_name: BASE_URL + value: tides.coloredcow.com + - option_name: DATABASE_USER + value: postgres + - option_name: DATABASE_PASSWORD + value: postgres + - option_name: POSTGRES_DB + value: tidesdb + - option_name: SECRET_KEY_BASE + value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 + - option_name: DATABASE_HOST + value: tidesdb.czpgx5pis6ka.ap-south-1.rds.amazonaws.com + - option_name: DATABASE_DB + value: tidesdb \ No newline at end of file diff --git a/.gitignore b/.gitignore index b9c5d455..888292c0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ project_tides-*.tar .elasticbeanstalk/* !.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.global.yml -.ebextensions/environment.config +# .ebextensions/environment.config config/dev.exs .DS_Store From c14073596931cfe726a8efa6191f5f0f180a9d57 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Mon, 25 May 2020 13:40:47 +0530 Subject: [PATCH 34/44] Removed config --- .ebextensions/environment.config | 15 --------------- .gitignore | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 .ebextensions/environment.config diff --git a/.ebextensions/environment.config b/.ebextensions/environment.config deleted file mode 100644 index c3671f16..00000000 --- a/.ebextensions/environment.config +++ /dev/null @@ -1,15 +0,0 @@ -option_settings: - - option_name: BASE_URL - value: tides.coloredcow.com - - option_name: DATABASE_USER - value: postgres - - option_name: DATABASE_PASSWORD - value: postgres - - option_name: POSTGRES_DB - value: tidesdb - - option_name: SECRET_KEY_BASE - value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 - - option_name: DATABASE_HOST - value: tidesdb.czpgx5pis6ka.ap-south-1.rds.amazonaws.com - - option_name: DATABASE_DB - value: tidesdb \ No newline at end of file diff --git a/.gitignore b/.gitignore index 888292c0..b9c5d455 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ project_tides-*.tar .elasticbeanstalk/* !.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.global.yml -# .ebextensions/environment.config +.ebextensions/environment.config config/dev.exs .DS_Store From 22c7f36b0c1dee7fea5219f9e906717b34e79bdc Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Mon, 25 May 2020 13:42:36 +0530 Subject: [PATCH 35/44] route test --- lib/project_tides_web/router.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/project_tides_web/router.ex b/lib/project_tides_web/router.ex index ca373ae2..60e6766b 100644 --- a/lib/project_tides_web/router.ex +++ b/lib/project_tides_web/router.ex @@ -16,12 +16,12 @@ defmodule ProjectTidesWeb.Router do # If your application does not have an admins-only section yet, # you can use Plug.BasicAuth to set up some basic authentication # as long as you are also using SSL (which you should anyway). - if Mix.env() in [:dev, :test] do + # if Mix.env() in [:dev, :test] do import Phoenix.LiveDashboard.Router scope "/" do pipe_through [:fetch_session, :protect_from_forgery] live_dashboard "/dashboard", metrics: ProjectTidesWeb.Telemetry - end + # end end end From 906031ab1bfa58b4285c6723eae3d10cc3e11c58 Mon Sep 17 00:00:00 2001 From: rudresh Date: Mon, 25 May 2020 14:38:50 +0530 Subject: [PATCH 36/44] using System.fetch_env! instead of System.get_env --- config/releases.exs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/releases.exs b/config/releases.exs index e265d0c6..5b2e6c41 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -2,20 +2,20 @@ # Added few checks for debug. # This file will be used for production release only. import Config -db_host = System.get_env("DATABASE_HOST") || +db_host = System.fetch_env!("DATABASE_HOST") || raise """ environment variable DATABASE_HOST is missing. """ -db_database = System.get_env("DATABASE_DB") || "postgres" -db_username = System.get_env("DATABASE_USER") || "postgres" -db_password = System.get_env("DATABASE_PASSWORD") || "postgres" +db_database = System.fetch_env!("DATABASE_DB") || "postgres" +db_username = System.fetch_env!("DATABASE_USER") || "postgres" +db_password = System.fetch_env!("DATABASE_PASSWORD") || "postgres" db_url = "ecto://#{db_username}:#{db_password}@#{db_host}/#{db_database}" config :project_tides, ProjectTides.Repo, url: db_url, - pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), + pool_size: String.to_integer(System.fetch_env!("POOL_SIZE") || "10"), show_sensitive_data_on_connection_error: true -secret_key_base = System.get_env("SECRET_KEY_BASE") || +secret_key_base = System.fetch_env!("SECRET_KEY_BASE") || raise """ environment variable SECRET_KEY_BASE is missing. You can generate one by calling: mix phx.gen.secret From db6bb11095d303a08971ed5f60a8197f6099f7c0 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Mon, 25 May 2020 22:23:12 +0530 Subject: [PATCH 37/44] Reverted config changes --- .ebextensions/environment.config | 15 +++++++++++++++ .gitignore | 2 +- config/releases.exs | 12 ++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 .ebextensions/environment.config diff --git a/.ebextensions/environment.config b/.ebextensions/environment.config new file mode 100644 index 00000000..c3671f16 --- /dev/null +++ b/.ebextensions/environment.config @@ -0,0 +1,15 @@ +option_settings: + - option_name: BASE_URL + value: tides.coloredcow.com + - option_name: DATABASE_USER + value: postgres + - option_name: DATABASE_PASSWORD + value: postgres + - option_name: POSTGRES_DB + value: tidesdb + - option_name: SECRET_KEY_BASE + value: qu7CXOpykb6wMdSJ6kYepIFxWevqByviwZZgOz03luuE4exd+vGSMG3WoThg1Vl7 + - option_name: DATABASE_HOST + value: tidesdb.czpgx5pis6ka.ap-south-1.rds.amazonaws.com + - option_name: DATABASE_DB + value: tidesdb \ No newline at end of file diff --git a/.gitignore b/.gitignore index b9c5d455..888292c0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ project_tides-*.tar .elasticbeanstalk/* !.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.global.yml -.ebextensions/environment.config +# .ebextensions/environment.config config/dev.exs .DS_Store diff --git a/config/releases.exs b/config/releases.exs index 5b2e6c41..e265d0c6 100644 --- a/config/releases.exs +++ b/config/releases.exs @@ -2,20 +2,20 @@ # Added few checks for debug. # This file will be used for production release only. import Config -db_host = System.fetch_env!("DATABASE_HOST") || +db_host = System.get_env("DATABASE_HOST") || raise """ environment variable DATABASE_HOST is missing. """ -db_database = System.fetch_env!("DATABASE_DB") || "postgres" -db_username = System.fetch_env!("DATABASE_USER") || "postgres" -db_password = System.fetch_env!("DATABASE_PASSWORD") || "postgres" +db_database = System.get_env("DATABASE_DB") || "postgres" +db_username = System.get_env("DATABASE_USER") || "postgres" +db_password = System.get_env("DATABASE_PASSWORD") || "postgres" db_url = "ecto://#{db_username}:#{db_password}@#{db_host}/#{db_database}" config :project_tides, ProjectTides.Repo, url: db_url, - pool_size: String.to_integer(System.fetch_env!("POOL_SIZE") || "10"), + pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"), show_sensitive_data_on_connection_error: true -secret_key_base = System.fetch_env!("SECRET_KEY_BASE") || +secret_key_base = System.get_env("SECRET_KEY_BASE") || raise """ environment variable SECRET_KEY_BASE is missing. You can generate one by calling: mix phx.gen.secret From e040776a18f5132f9257d3f0a59b46eb5ccce7f8 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Tue, 26 May 2020 00:27:37 +0530 Subject: [PATCH 38/44] test ci changes --- test/project_tides_web/views/error_view_test.exs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/project_tides_web/views/error_view_test.exs b/test/project_tides_web/views/error_view_test.exs index 5585dc14..2bf4ab0e 100644 --- a/test/project_tides_web/views/error_view_test.exs +++ b/test/project_tides_web/views/error_view_test.exs @@ -12,4 +12,8 @@ defmodule ProjectTidesWeb.ErrorViewTest do assert render(ProjectTidesWeb.ErrorView, "500.json", []) == %{errors: %{detail: "Internal Server Error"}} end + test "renders 403.json" do + assert render(ProjectTidesWeb.ErrorView, "403.json", []) == + %{errors: %{detail: "Internal Server Error"}} + end end From fd49cbc42072c762c5ccfb4b48352d9f65a78b4e Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Tue, 26 May 2020 00:34:38 +0530 Subject: [PATCH 39/44] revertd --- test/project_tides_web/views/error_view_test.exs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/project_tides_web/views/error_view_test.exs b/test/project_tides_web/views/error_view_test.exs index 2bf4ab0e..5585dc14 100644 --- a/test/project_tides_web/views/error_view_test.exs +++ b/test/project_tides_web/views/error_view_test.exs @@ -12,8 +12,4 @@ defmodule ProjectTidesWeb.ErrorViewTest do assert render(ProjectTidesWeb.ErrorView, "500.json", []) == %{errors: %{detail: "Internal Server Error"}} end - test "renders 403.json" do - assert render(ProjectTidesWeb.ErrorView, "403.json", []) == - %{errors: %{detail: "Internal Server Error"}} - end end From a7302c54afad9a9ee341a4f9a6d9d4f9adb2bb08 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Tue, 26 May 2020 09:06:50 +0530 Subject: [PATCH 40/44] demo test cases --- test/project_tides_web/views/error_view_test.exs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/project_tides_web/views/error_view_test.exs b/test/project_tides_web/views/error_view_test.exs index 5585dc14..2bf4ab0e 100644 --- a/test/project_tides_web/views/error_view_test.exs +++ b/test/project_tides_web/views/error_view_test.exs @@ -12,4 +12,8 @@ defmodule ProjectTidesWeb.ErrorViewTest do assert render(ProjectTidesWeb.ErrorView, "500.json", []) == %{errors: %{detail: "Internal Server Error"}} end + test "renders 403.json" do + assert render(ProjectTidesWeb.ErrorView, "403.json", []) == + %{errors: %{detail: "Internal Server Error"}} + end end From 8426ce251815b2ff48c721a35aab2d9f0e66b4cc Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Tue, 26 May 2020 09:11:21 +0530 Subject: [PATCH 41/44] Reverted demo testcases --- test/project_tides_web/views/error_view_test.exs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/project_tides_web/views/error_view_test.exs b/test/project_tides_web/views/error_view_test.exs index 2bf4ab0e..4bdcde93 100644 --- a/test/project_tides_web/views/error_view_test.exs +++ b/test/project_tides_web/views/error_view_test.exs @@ -12,8 +12,5 @@ defmodule ProjectTidesWeb.ErrorViewTest do assert render(ProjectTidesWeb.ErrorView, "500.json", []) == %{errors: %{detail: "Internal Server Error"}} end - test "renders 403.json" do - assert render(ProjectTidesWeb.ErrorView, "403.json", []) == - %{errors: %{detail: "Internal Server Error"}} - end + end From dd23ae30c349a263d15cd34063e9c20a1ae8a303 Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Wed, 27 May 2020 15:05:29 +0530 Subject: [PATCH 42/44] Failure condition checks --- test/project_tides_web/views/error_view_test.exs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/project_tides_web/views/error_view_test.exs b/test/project_tides_web/views/error_view_test.exs index 5585dc14..3ae3aead 100644 --- a/test/project_tides_web/views/error_view_test.exs +++ b/test/project_tides_web/views/error_view_test.exs @@ -12,4 +12,9 @@ defmodule ProjectTidesWeb.ErrorViewTest do assert render(ProjectTidesWeb.ErrorView, "500.json", []) == %{errors: %{detail: "Internal Server Error"}} end + + test "renders 403.json" do + assert render(ProjectTidesWeb.ErrorView, "403.json", []) == + %{errors: %{detail: "Internal Server Error"}} + end end From ed26d817ab032f3e69f97a03245cf414a73ad08d Mon Sep 17 00:00:00 2001 From: satendra-sr Date: Wed, 27 May 2020 15:09:12 +0530 Subject: [PATCH 43/44] Reverted test cases --- test/project_tides_web/views/error_view_test.exs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/project_tides_web/views/error_view_test.exs b/test/project_tides_web/views/error_view_test.exs index 3ae3aead..5585dc14 100644 --- a/test/project_tides_web/views/error_view_test.exs +++ b/test/project_tides_web/views/error_view_test.exs @@ -12,9 +12,4 @@ defmodule ProjectTidesWeb.ErrorViewTest do assert render(ProjectTidesWeb.ErrorView, "500.json", []) == %{errors: %{detail: "Internal Server Error"}} end - - test "renders 403.json" do - assert render(ProjectTidesWeb.ErrorView, "403.json", []) == - %{errors: %{detail: "Internal Server Error"}} - end end From 73c9a69dbef83a33679f128bdf359a590bf899dd Mon Sep 17 00:00:00 2001 From: Satendra Rawat <39792899+Satendra-SR@users.noreply.github.com> Date: Fri, 5 Jun 2020 12:34:27 +0530 Subject: [PATCH 44/44] formating-updates --- Dockerrun.aws.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json index 6da0f515..02d1cf79 100644 --- a/Dockerrun.aws.json +++ b/Dockerrun.aws.json @@ -3,11 +3,11 @@ "Image": { "Name": "023004991146.dkr.ecr.ap-south-1.amazonaws.com/tides:latest", "Update": "true" - }, - "Ports": [ + }, + "Ports": [ { "HostPort": "80", "ContainerPort": "4000" } - ] - } \ No newline at end of file + ] +}