Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion devops/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,28 @@ export AWS_DEFAULT_REGION=us-east-1
export AWS_PAGER=""

PRODUCTION=false
LOCAL=false

# Argument parsing
# pass "-p" flag to deploy to production
# pass "-l" flag to build locally before deploying

while getopts "p" opt; do
while getopts "pl" opt; do
case $opt in
p)
PRODUCTION=true
;;
l)
LOCAL=true
;;
esac
done

if $LOCAL; then
echo "Building application locally..."
(cd "$(dirname "$0")/.." && npm ci && npm run build)
fi

$PRODUCTION && HOSTNAME="regionalrail.rocks" || HOSTNAME="rre-beta.labs.transitmatters.org"
$PRODUCTION && DOMAIN="regionalrail.rocks" || DOMAIN="labs.transitmatters.org"
$PRODUCTION && CERT_ARN="$TM_RRE_RR_RKS_CERT_ARN" || CERT_ARN="$TM_LABS_WILDCARD_CERT_ARN"
Expand Down
42 changes: 42 additions & 0 deletions devops/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
name: nodejs
state: present

- name: Install the Datadog Agent
become: yes
become_user: root
import_role:
name: datadog.dd.agent

- name: get latest github repo
git:
repo: https://github.com/transitmatters/regional-rail-explorer.git
Expand Down Expand Up @@ -112,3 +118,39 @@
state: restarted
daemon_reload: true
name: regional-rail-explorer

vars:
datadog_api_key: "{{ lookup('env', 'DD_API_KEY') }}"
datadog_site: "datadoghq.com"
datadog_config:
tags:
- "git.repository_url:github.com/transitmatters/regional-rail-explorer"
- "git.commit.sha:{{ lookup('env', 'GIT_SHA') }}"
- "version:{{ lookup('env', 'GIT_SHA') }}"
apm_config:
enabled: true
process_config:
enabled: "true" # type: string
logs_enabled: true
network_config:
enabled: true
system_probe_config:
enable_oom_kill: true
datadog_checks:
python:
logs:
- type: file
path: "/home/ubuntu/regional-rail-explorer/regional-rail-explorer.log"
service: "regional-rail-explorer"
source: python
sourcecategory: sourcecode
- type: file
path: "/home/ubuntu/regional-rail-explorer/s3_upload.log"
service: "regional-rail-explorer"
source: python
sourcecategory: sourcecode
systemd:
init_config:
instances:
- unit_names:
- regional-rail-explorer.service
Loading