From e37281771d69bb38ef7ad7c83c1a8b907b67cae8 Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Tue, 31 Dec 2019 07:52:31 -0500 Subject: [PATCH] Added email address variable --- README.md | 3 ++- config/environments/production.rb | 2 +- deploy/kubernetes/README.md | 2 ++ deploy/kubernetes/manifests/wrestlingdev.yaml | 10 ++++++++++ deploy/kubernetes/secrets/secrets.yaml | 4 +++- 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e26b2cb..48b570b 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ The production version of this is currently deployed in Kubernetes. See [Deployi * `WRESTLINGDEV_DB_PORT=databaseport` * `WRESTLINGDEV_DEVISE_SECRET_KEY=devise_key` can be generated with `rake secret` * `WRESTLINGDEV_SECRET_KEY_BASE=secret_key` can be generated with `rake secret` -* `WRESTLINGDEV_EMAIL_PWD=emailpwd` +* `WRESTLINGDEV_EMAIL_PWD=emailpwd` Email has to be a gmail account for now. +* `WRESTLINGDEV_EMAIL=email address` **Optional environment variables** * `MEMCACHIER_PASSWORD=memcachier_password` needed for caching password diff --git a/config/environments/production.rb b/config/environments/production.rb index c8cd017..51d1c8d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -104,7 +104,7 @@ Wrestling::Application.configure do :address => "smtp.gmail.com", :port => 587, :domain => "gmail.com", - :user_name => "jacob.wimer@gmail.com", + :user_name => ENV["WRESTLINGDEV_EMAIL"], :password => ENV["WRESTLINGDEV_EMAIL_PWD"], :authentication => :plain, :enable_starttls_auto => true diff --git a/deploy/kubernetes/README.md b/deploy/kubernetes/README.md index 7bc5346..12e9c01 100644 --- a/deploy/kubernetes/README.md +++ b/deploy/kubernetes/README.md @@ -28,5 +28,7 @@ Each push to master updates the docker `prod` tag and also pushes a tag with the Right now, mariadb's root password comes from the secrets.yaml and wrestlingdev uses the root password to run. Ideally, you'd create another secret for mariadb's root password and you'd create a user specifically for wrestlingdev. From a mysql shell> `CREATE USER ${username} IDENTIFIED BY '${password}'; GRANT ALL PRIVILEGES ON ${database}.* TO ${username}; FLUSH PRIVILEGES;` $database would be wrestlingdev. I'll do this automatically later. +Right now, we're also only using gmail for email. + ## Recommended cloud machines In production, this runs on GKE. I have two node pools. The first is 2 x `n2-high-cpu-2` ($12.63/month preemptible). That pool can run 1 "copy" of the application. That means 2 x app pods, 1 x worker, 1 x memcached, and 1 x mariadb. The second node pool is an autoscale from 0-10 and is of the machine type `n1-standard-1` ($7.30/ month preemptible). This pool is scritly for scaling the app pods and the worker pods. \ No newline at end of file diff --git a/deploy/kubernetes/manifests/wrestlingdev.yaml b/deploy/kubernetes/manifests/wrestlingdev.yaml index 377bb11..34aed12 100644 --- a/deploy/kubernetes/manifests/wrestlingdev.yaml +++ b/deploy/kubernetes/manifests/wrestlingdev.yaml @@ -68,6 +68,16 @@ spec: secretKeyRef: name: wrestlingdev-secrets key: railssecretkey + - name: WRESTLINGDEV_EMAIL_PWD + valueFrom: + secretKeyRef: + name: wrestlingdev-secrets + key: gmailpassword + - name: WRESTLINGDEV_EMAIL + valueFrom: + secretKeyRef: + name: wrestlingdev-secrets + key: gmailemail resources: limits: cpu: "0.5" diff --git a/deploy/kubernetes/secrets/secrets.yaml b/deploy/kubernetes/secrets/secrets.yaml index 7610432..b2b3ec4 100644 --- a/deploy/kubernetes/secrets/secrets.yaml +++ b/deploy/kubernetes/secrets/secrets.yaml @@ -8,4 +8,6 @@ stringData: dbusername: root dbpassword: PUT_SECRET_HERE devisesecretkey: PUT_SECRET_HERE get from running rails secret - railssecretkey: PUT_SECRET_HERE get from running rails secret \ No newline at end of file + railssecretkey: PUT_SECRET_HERE get from running rails secret + emailpassword: PUT_EMAIL_PASSWORD_HERE + gmailemail: PUT EMAIL ADDRESS HERE \ No newline at end of file