From d0c513221b9f965493a2f3d9f9cc6b938feaa921 Mon Sep 17 00:00:00 2001 From: Katlyn Alo <26312638+Kat-Alo@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:51:08 -0600 Subject: [PATCH 1/5] updating DEVELOPING docs with new example env --- DEVELOPING.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DEVELOPING.md b/DEVELOPING.md index 9de28cba..a0b188dc 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -24,14 +24,13 @@ gem install bundler bundle install ``` -In order to be allowed to login to Klaxon once it's running on your machine, it'll need to know that your email address is. Create a file named `.env` and paste in these two items: +In order to be allowed to login to Klaxon once it's running on your machine, it'll need to know that your email address is. Create an env file for local development like so: ``` -ADMIN_EMAILS="my_awesome_email@gmail.com" -HOST='localhost:5000' +cp .env.local.example .env.local ``` -Feel free to substitute in your email address. In development, Klaxon doesn't actually send emails locally, so a real address is not required. +Feel free to substitute in your email address in `ADMIN_EMAILS`. In development, Klaxon doesn't actually send emails locally, so a real address is not required. But, those will be the addresses used to log into the app. Now that's set, you'll run a couple of commands for Rails to create Klaxon's database on your machine. From eac49a11e6ffbca8a9e48c3347b342530fd11689 Mon Sep 17 00:00:00 2001 From: Katlyn Alo <26312638+Kat-Alo@users.noreply.github.com> Date: Fri, 1 Sep 2023 12:52:40 -0600 Subject: [PATCH 2/5] adding .env.local.example --- .env.local.example | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .env.local.example diff --git a/.env.local.example b/.env.local.example new file mode 100644 index 00000000..d3c45422 --- /dev/null +++ b/.env.local.example @@ -0,0 +1,28 @@ +# App settings +RACK_ENV=development +RAILS_ENV=development +HOST='localhost:3000' +PORT=3000 + +# DB settings needed only for db creation +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_DB=klaxon +POSTGRES_HOST=db + +# Postgres URI pattern is postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...] +DATABASE_URL="postgres://postgres:postgres@db:5432/klaxon" +SECRET_KEY_BASE="secret_key_base" +ADMIN_EMAILS="admin@news.org" # comma-separated list of email addresses + +# Email config if using Sendgrid +SENDGRID_USERNAME= +SENDGRID_PASSWORD= + +# Email config if using Amazon SES +SMTP_PROVIDER= # SES +SES_ADDRESS= +SES_USERNAME= +SES_PASSWORD= +SES_DOMAIN= +MAILER_FROM_ADDRESS= From 67fbc179a8992460df8acdb3e98b37d16cddaf80 Mon Sep 17 00:00:00 2001 From: Katlyn Alo <26312638+Kat-Alo@users.noreply.github.com> Date: Fri, 1 Sep 2023 13:01:24 -0600 Subject: [PATCH 3/5] resolving docker-compose merge conflicts --- .devcontainer/docker-compose.yml | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 00000000..fc3730af --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,49 @@ +version: '3' + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + + volumes: + - ../..:/workspaces:cached + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + network_mode: service:db + + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + env_file: + - .env.local + + db: + image: postgres:latest + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data + - ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql + env_file: + - .env.local + # Your config/database.yml should use the user and password you set here, + # and host "db" (as that's the name of this service). You can use whatever + # database name you want. Use `bin/rails db:prepare` to create the database. + # + # Example: + # + # development: + # <<: *default + # host: db + # username: postgres + # password: postgres + # database: myapp_development + + # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + +volumes: + postgres-data: + From dff1ae73143046ad2391b722a8fa32962eec7267 Mon Sep 17 00:00:00 2001 From: Katlyn Alo <26312638+Kat-Alo@users.noreply.github.com> Date: Fri, 1 Sep 2023 13:01:45 -0600 Subject: [PATCH 4/5] merge conflict: tracking example env files but not actual env files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 6cae6eb8..cd091d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ snapshots /app/assets/builds/* !/app/assets/builds/.keep + +.env* +!.env.*.example From ed46db35c172ec027eda8b5c2569cdacdcb6e5ed Mon Sep 17 00:00:00 2001 From: Katlyn Alo <26312638+Kat-Alo@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:34:24 -0600 Subject: [PATCH 5/5] deleting docker-compose to be consistent with develop --- .devcontainer/docker-compose.yml | 49 -------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml deleted file mode 100644 index fc3730af..00000000 --- a/.devcontainer/docker-compose.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: '3' - -services: - app: - build: - context: .. - dockerfile: .devcontainer/Dockerfile - - volumes: - - ../..:/workspaces:cached - - # Overrides default command so things don't shut down after the process ends. - command: sleep infinity - - # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. - network_mode: service:db - - # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. - # (Adding the "ports" property to this file will not forward from a Codespace.) - env_file: - - .env.local - - db: - image: postgres:latest - restart: unless-stopped - volumes: - - postgres-data:/var/lib/postgresql/data - - ./create-db-user.sql:/docker-entrypoint-initdb.d/create-db-user.sql - env_file: - - .env.local - # Your config/database.yml should use the user and password you set here, - # and host "db" (as that's the name of this service). You can use whatever - # database name you want. Use `bin/rails db:prepare` to create the database. - # - # Example: - # - # development: - # <<: *default - # host: db - # username: postgres - # password: postgres - # database: myapp_development - - # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. - # (Adding the "ports" property to this file will not forward from a Codespace.) - -volumes: - postgres-data: -