From 39fa8a80328be927b175fcdea449b94634c584c4 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Tue, 10 Apr 2018 06:43:44 -0700 Subject: [PATCH] moved to integreat --- config/prod.edn | 1 + config/staging.edn | 1 + docker-compose.prod.yml | 4 +-- docker-compose.staging.yml | 8 ++--- docker-compose.yml | 4 +-- src/clj/auto_ap/db/companies.clj | 3 +- src/clj/auto_ap/db/invoices.clj | 2 +- src/clj/auto_ap/db/vendors.clj | 3 +- src/clj/auto_ap/routes/companies.clj | 1 - src/clj/auto_ap/routes/reminders.clj | 3 +- src/clj/auto_ap/routes/utils.clj | 4 +-- src/clj/auto_ap/routes/vendors.clj | 3 +- terraform/prod.tfvars | 6 ++-- terraform/staging.tfvars | 6 ++-- .../prod/terraform.tfstate | 16 +++++----- .../prod/terraform.tfstate.backup | 31 +++---------------- .../staging/terraform.tfstate | 16 +++++----- .../staging/terraform.tfstate.backup | 8 ++--- 18 files changed, 50 insertions(+), 70 deletions(-) diff --git a/config/prod.edn b/config/prod.edn index a8d67a2c..d0412f61 100644 --- a/config/prod.edn +++ b/config/prod.edn @@ -5,4 +5,5 @@ :aws-secret-access-key "emIzqz9zW+5WrbJHwc1MI0gSS9IXF5feFFxnQI+7" :aws-region "us-east-1" :invoice-import-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-mail-prod" + :invoice-email "invoices@mail.app.integreatconsult.com" } diff --git a/config/staging.edn b/config/staging.edn index 035db3ea..ce623616 100644 --- a/config/staging.edn +++ b/config/staging.edn @@ -5,4 +5,5 @@ :aws-secret-access-key "Z+AOjQU9M4SwKVU2meYtyNxXtz1Axu/9xohvteXf" :aws-region "us-east-1" :invoice-import-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-mail-staging" + :invoice-email "invoices-staging@mail.app.integreatconsult.com" } diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 7bb0fa42..8cf237fd 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -21,8 +21,8 @@ services: restart: always environment: config: /usr/local/config/prod.edn - VIRTUAL_HOST: integreat.aws.brycecovertoperations.com - LETSENCRYPT_HOST: integreat.aws.brycecovertoperations.com + VIRTUAL_HOST: app.integreatconsult.com + LETSENCRYPT_HOST: staging.app.integreatconsult.com,app.integreatconsult.com LETSENCRYPT_EMAIL: le@brycecovertoperations.com database: restart: always diff --git a/docker-compose.staging.yml b/docker-compose.staging.yml index 4f10952a..0d66012d 100644 --- a/docker-compose.staging.yml +++ b/docker-compose.staging.yml @@ -1,7 +1,7 @@ version: '3' services: nginx-proxy: - restart: always + restart: "always" ports: - "8080:80" - "8443:443" @@ -11,7 +11,7 @@ services: - /opt/integreat/staging/etc/nginx/vhost.d:/etc/nginx/vhost.d - /opt/integreat/staging/usr/share/nginx/html:/usr/share/nginx/html letsencrypt: - restart: always + restart: "always" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /opt/integreat/staging/certs/:/etc/nginx/certs @@ -21,8 +21,8 @@ services: restart: always environment: config: /usr/local/config/staging.edn - VIRTUAL_HOST: staging.integreat.aws.brycecovertoperations.com - LETSENCRYPT_HOST: staging.integreat.aws.brycecovertoperations.com + VIRTUAL_HOST: staging.app.integreatconsult.com + LETSENCRYPT_HOST: staging.app.integreatconsult.com,app.integreatconsult.com LETSENCRYPT_EMAIL: le@brycecovertoperations.com database: restart: always diff --git a/docker-compose.yml b/docker-compose.yml index 332e97a2..85ebcecf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: nginx-proxy: image: jwilder/nginx-proxy:alpine labels: - - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" + - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./data/certs/:/etc/nginx/certs:ro @@ -24,7 +24,7 @@ services: - database environment: config: /usr/local/config/local.edn - VIRTUAL_HOST: local.integreat.aws.brycecovertoperations.com + VIRTUAL_HOST: local.app.integreatconsult.com database: image: postgres:9-alpine environment: diff --git a/src/clj/auto_ap/db/companies.clj b/src/clj/auto_ap/db/companies.clj index a5b41e88..012b59de 100644 --- a/src/clj/auto_ap/db/companies.clj +++ b/src/clj/auto_ap/db/companies.clj @@ -1,5 +1,6 @@ (ns auto-ap.db.companies - (:require [auto-ap.db.utils :refer [clj->db db->clj get-conn assign-namespace]] + (:require [auto-ap.db.utils :refer [assign-namespace clj->db db->clj + get-conn]] [auto-ap.entities.companies :as entity] [clojure.edn :as edn] [clojure.java.jdbc :as j])) diff --git a/src/clj/auto_ap/db/invoices.clj b/src/clj/auto_ap/db/invoices.clj index eb22c1a2..85497fce 100644 --- a/src/clj/auto_ap/db/invoices.clj +++ b/src/clj/auto_ap/db/invoices.clj @@ -33,7 +33,7 @@ (insert-multi! (for [{:keys [total date invoice-number customer-identifier vendor] :as row} parsed-invoices] (do - (println row) + (assoc row :company-id (::company/id (parse/best-match companies customer-identifier)) :imported false diff --git a/src/clj/auto_ap/db/vendors.clj b/src/clj/auto_ap/db/vendors.clj index 42c19e66..22c90d9c 100644 --- a/src/clj/auto_ap/db/vendors.clj +++ b/src/clj/auto_ap/db/vendors.clj @@ -1,5 +1,6 @@ (ns auto-ap.db.vendors - (:require [auto-ap.db.utils :refer [clj->db db->clj get-conn assign-namespace]] + (:require [auto-ap.db.utils :refer [assign-namespace clj->db db->clj + get-conn]] [auto-ap.entities.vendors :as entities] [clojure.edn :as edn] [clojure.java.jdbc :as j])) diff --git a/src/clj/auto_ap/routes/companies.clj b/src/clj/auto_ap/routes/companies.clj index 0fcf1425..6f56fdd6 100644 --- a/src/clj/auto_ap/routes/companies.clj +++ b/src/clj/auto_ap/routes/companies.clj @@ -2,7 +2,6 @@ (:require [auto-ap.db.companies :as companies] [auto-ap.routes.utils :refer [wrap-secure wrap-spec]] [auto-ap.entities.companies :as entity] - [clojure.spec.alpha :as s] [compojure.core :refer [GET PUT context defroutes wrap-routes]])) diff --git a/src/clj/auto_ap/routes/reminders.clj b/src/clj/auto_ap/routes/reminders.clj index 6d8181bc..c9cd7a4f 100644 --- a/src/clj/auto_ap/routes/reminders.clj +++ b/src/clj/auto_ap/routes/reminders.clj @@ -3,6 +3,7 @@ [auto-ap.db.reminders :as reminders] [auto-ap.db.vendors :as vendors] [auto-ap.routes.utils :refer [wrap-secure]] + [config.core :refer [env]] [clj-http.client :as http] [clj-time.coerce :as c] [clj-time.core :as time] @@ -42,7 +43,7 @@ (doseq [{:keys [vendor-name email id]} reminders] (println "Sending email to" email) (ses/send-email :destination {:to-addresses [email]} - :source "invoices@mail.integreat.aws.brycecovertoperations.com" + :source (:invoice-email env) :message {:subject "Reminder to send invoices" :body {:html (str "

Hello " vendor-name ",

This is a reminder to send this week's invoices to us. You can just reply to this email.

- Integreat.

") :text (str "Hello " vendor-name ",\r\nThis is a reminder to send this week's invoices to us. You can just reply to this email.\r\n - Integreat.")}}) diff --git a/src/clj/auto_ap/routes/utils.clj b/src/clj/auto_ap/routes/utils.clj index 7be97306..8b997750 100644 --- a/src/clj/auto_ap/routes/utils.clj +++ b/src/clj/auto_ap/routes/utils.clj @@ -1,6 +1,6 @@ (ns auto-ap.routes.utils - (:require [clojure.spec.alpha :as s] - [buddy.auth :refer [authenticated?]])) + (:require [buddy.auth :refer [authenticated?]] + [clojure.spec.alpha :as s])) (defn wrap-secure [handler] (fn [request] diff --git a/src/clj/auto_ap/routes/vendors.clj b/src/clj/auto_ap/routes/vendors.clj index 1451271d..a7f78769 100644 --- a/src/clj/auto_ap/routes/vendors.clj +++ b/src/clj/auto_ap/routes/vendors.clj @@ -1,8 +1,7 @@ (ns auto-ap.routes.vendors (:require [auto-ap.db.vendors :as vendors] - [auto-ap.routes.utils :refer [wrap-secure wrap-spec]] [auto-ap.entities.vendors :as entity] - [clojure.spec.alpha :as s] + [auto-ap.routes.utils :refer [wrap-secure wrap-spec]] [compojure.core :refer [GET POST PUT context defroutes wrap-routes]])) diff --git a/terraform/prod.tfvars b/terraform/prod.tfvars index e565c840..532bcee8 100644 --- a/terraform/prod.tfvars +++ b/terraform/prod.tfvars @@ -1,6 +1,6 @@ aws_access_key_id="AKIAINHACMVQJ6NYD26A" aws_secret_access_key="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" -domain="integreat.aws.brycecovertoperations.com" -invoice_address="invoices@mail.integreat.aws.brycecovertoperations.com" -base_url="https://integreat.aws.brycecovertoperations.com" +domain="app.integreatconsult.com" +invoice_address="invoices@mail.app.integreatconsult.com" +base_url="https://app.integreatconsult.com" stage="prod" diff --git a/terraform/staging.tfvars b/terraform/staging.tfvars index 5b6f122b..aae7d302 100644 --- a/terraform/staging.tfvars +++ b/terraform/staging.tfvars @@ -1,6 +1,6 @@ aws_access_key_id="AKIAINHACMVQJ6NYD26A" aws_secret_access_key="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" -domain="staging.integreat.aws.brycecovertoperations.com" -invoice_address="invoices-staging@mail.integreat.aws.brycecovertoperations.com" -base_url="https://staging.integreat.aws.brycecovertoperations.com:8443" +domain="staging.app.integreatconsult.com" +invoice_address="invoices-staging@mail.app.integreatconsult.com" +base_url="https://staging.app.integreatconsult.com:8443" stage="staging" diff --git a/terraform/terraform.tfstate.d/prod/terraform.tfstate b/terraform/terraform.tfstate.d/prod/terraform.tfstate index 887d27b0..dc7fd1ae 100644 --- a/terraform/terraform.tfstate.d/prod/terraform.tfstate +++ b/terraform/terraform.tfstate.d/prod/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 3, "terraform_version": "0.11.5", - "serial": 24, + "serial": 26, "lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51", "modules": [ { @@ -249,7 +249,7 @@ "lambda_action.#": "0", "name": "store-prod", "recipients.#": "1", - "recipients.2059710502": "invoices@mail.integreat.aws.brycecovertoperations.com", + "recipients.1936553836": "invoices@mail.app.integreatconsult.com", "rule_set_name": "default-rule-set", "s3_action.#": "1", "s3_action.4268582484.bucket_name": "integreat-mail-prod", @@ -321,13 +321,13 @@ "aws_sns_topic.reminder_topic" ], "primary": { - "id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34", + "id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:d55e8a84-a979-4bc2-9822-afc2dd047a35", "attributes": { - "arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34", + "arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod:d55e8a84-a979-4bc2-9822-afc2dd047a35", "confirmation_timeout_in_minutes": "1", - "endpoint": "https://integreat.aws.brycecovertoperations.com/api/reminders/send", + "endpoint": "https://app.integreatconsult.com/api/reminders/send", "endpoint_auto_confirms": "true", - "id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34", + "id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:d55e8a84-a979-4bc2-9822-afc2dd047a35", "protocol": "https", "raw_message_delivery": "false", "topic_arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod" @@ -369,11 +369,11 @@ "type": "aws_caller_identity", "depends_on": [], "primary": { - "id": "2018-04-08 23:28:03.708287838 +0000 UTC", + "id": "2018-04-10 06:39:11.533275039 +0000 UTC", "attributes": { "account_id": "679918342773", "arn": "arn:aws:iam::679918342773:user/bryce", - "id": "2018-04-08 23:28:03.708287838 +0000 UTC", + "id": "2018-04-10 06:39:11.533275039 +0000 UTC", "user_id": "AIDAJPUJFTOKO4IRADMV4" }, "meta": {}, diff --git a/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup b/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup index 08f1741a..c8a4e227 100644 --- a/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup +++ b/terraform/terraform.tfstate.d/prod/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 3, "terraform_version": "0.11.5", - "serial": 24, + "serial": 26, "lineage": "9b630886-8cee-a57d-c7a2-4f19f13f9c51", "modules": [ { @@ -249,7 +249,7 @@ "lambda_action.#": "0", "name": "store-prod", "recipients.#": "1", - "recipients.2059710502": "invoices@mail.integreat.aws.brycecovertoperations.com", + "recipients.1936553836": "invoices@mail.app.integreatconsult.com", "rule_set_name": "default-rule-set", "s3_action.#": "1", "s3_action.4268582484.bucket_name": "integreat-mail-prod", @@ -315,29 +315,6 @@ "deposed": [], "provider": "provider.aws" }, - "aws_sns_topic_subscription.send_reminders_to_service": { - "type": "aws_sns_topic_subscription", - "depends_on": [ - "aws_sns_topic.reminder_topic" - ], - "primary": { - "id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34", - "attributes": { - "arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34", - "confirmation_timeout_in_minutes": "1", - "endpoint": "https://integreat.aws.brycecovertoperations.com/api/reminders/send", - "endpoint_auto_confirms": "true", - "id": "arn:aws:sns:us-east-1:679918342773:reminders-prod:760fbd12-3e50-43e1-859e-fefdc0751c34", - "protocol": "https", - "raw_message_delivery": "false", - "topic_arn": "arn:aws:sns:us-east-1:679918342773:reminders-prod" - }, - "meta": {}, - "tainted": false - }, - "deposed": [], - "provider": "provider.aws" - }, "aws_sqs_queue.integreat-mail": { "type": "aws_sqs_queue", "depends_on": [ @@ -369,11 +346,11 @@ "type": "aws_caller_identity", "depends_on": [], "primary": { - "id": "2018-04-08 21:28:57.063150249 +0000 UTC", + "id": "2018-04-10 06:21:49.828482761 +0000 UTC", "attributes": { "account_id": "679918342773", "arn": "arn:aws:iam::679918342773:user/bryce", - "id": "2018-04-08 21:28:57.063150249 +0000 UTC", + "id": "2018-04-10 06:21:49.828482761 +0000 UTC", "user_id": "AIDAJPUJFTOKO4IRADMV4" }, "meta": {}, diff --git a/terraform/terraform.tfstate.d/staging/terraform.tfstate b/terraform/terraform.tfstate.d/staging/terraform.tfstate index 7d7333d9..20b58c07 100644 --- a/terraform/terraform.tfstate.d/staging/terraform.tfstate +++ b/terraform/terraform.tfstate.d/staging/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 3, "terraform_version": "0.11.5", - "serial": 4, + "serial": 6, "lineage": "91d10fe0-8033-8778-c202-78d5a81632e8", "modules": [ { @@ -249,7 +249,7 @@ "lambda_action.#": "0", "name": "store-staging", "recipients.#": "1", - "recipients.392613647": "invoices-staging@mail.integreat.aws.brycecovertoperations.com", + "recipients.3424326602": "invoices-staging@mail.app.integreatconsult.com", "rule_set_name": "default-rule-set", "s3_action.#": "1", "s3_action.2918620842.bucket_name": "integreat-mail-staging", @@ -321,13 +321,13 @@ "aws_sns_topic.reminder_topic" ], "primary": { - "id": "arn:aws:sns:us-east-1:679918342773:reminders-staging:ad5d6da5-c68e-4897-919e-77019cb115dc", + "id": "arn:aws:sns:us-east-1:679918342773:reminders-staging:f21bb21a-f5e9-4bce-afa5-7fa5b1ec8581", "attributes": { - "arn": "arn:aws:sns:us-east-1:679918342773:reminders-staging:ad5d6da5-c68e-4897-919e-77019cb115dc", + "arn": "arn:aws:sns:us-east-1:679918342773:reminders-staging:f21bb21a-f5e9-4bce-afa5-7fa5b1ec8581", "confirmation_timeout_in_minutes": "1", - "endpoint": "https://staging.integreat.aws.brycecovertoperations.com:8443/api/reminders/send", + "endpoint": "https://staging.app.integreatconsult.com:8443/api/reminders/send", "endpoint_auto_confirms": "true", - "id": "arn:aws:sns:us-east-1:679918342773:reminders-staging:ad5d6da5-c68e-4897-919e-77019cb115dc", + "id": "arn:aws:sns:us-east-1:679918342773:reminders-staging:f21bb21a-f5e9-4bce-afa5-7fa5b1ec8581", "protocol": "https", "raw_message_delivery": "false", "topic_arn": "arn:aws:sns:us-east-1:679918342773:reminders-staging" @@ -369,11 +369,11 @@ "type": "aws_caller_identity", "depends_on": [], "primary": { - "id": "2018-04-08 23:24:51.436371727 +0000 UTC", + "id": "2018-04-10 06:20:31.972433424 +0000 UTC", "attributes": { "account_id": "679918342773", "arn": "arn:aws:iam::679918342773:user/bryce", - "id": "2018-04-08 23:24:51.436371727 +0000 UTC", + "id": "2018-04-10 06:20:31.972433424 +0000 UTC", "user_id": "AIDAJPUJFTOKO4IRADMV4" }, "meta": {}, diff --git a/terraform/terraform.tfstate.d/staging/terraform.tfstate.backup b/terraform/terraform.tfstate.d/staging/terraform.tfstate.backup index 06b0d185..4bb708ff 100644 --- a/terraform/terraform.tfstate.d/staging/terraform.tfstate.backup +++ b/terraform/terraform.tfstate.d/staging/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 3, "terraform_version": "0.11.5", - "serial": 4, + "serial": 6, "lineage": "91d10fe0-8033-8778-c202-78d5a81632e8", "modules": [ { @@ -249,7 +249,7 @@ "lambda_action.#": "0", "name": "store-staging", "recipients.#": "1", - "recipients.392613647": "invoices-staging@mail.integreat.aws.brycecovertoperations.com", + "recipients.3424326602": "invoices-staging@mail.app.integreatconsult.com", "rule_set_name": "default-rule-set", "s3_action.#": "1", "s3_action.2918620842.bucket_name": "integreat-mail-staging", @@ -346,11 +346,11 @@ "type": "aws_caller_identity", "depends_on": [], "primary": { - "id": "2018-04-08 22:13:07.617577412 +0000 UTC", + "id": "2018-04-10 05:26:29.468970177 +0000 UTC", "attributes": { "account_id": "679918342773", "arn": "arn:aws:iam::679918342773:user/bryce", - "id": "2018-04-08 22:13:07.617577412 +0000 UTC", + "id": "2018-04-10 05:26:29.468970177 +0000 UTC", "user_id": "AIDAJPUJFTOKO4IRADMV4" }, "meta": {},