2.0 KiB

Web App Hosting (static HTML)

Web app is deployed to an S3 bucket. Each top level directory in this bucket represents a different deployed environment. For example:

s3://pm.jdb-labs.com
├── prod
│   ├── logs
│   │   └── cloudfront
│   └── webroot
│       ├── css
│       ├── img
│       ├── js
│       ├── index.html
│       └── ...
└── dev
    ├── logs
    └── webroot

API Hosting

API is served from razgriz:

Server Setup Notes

The home folder of the pmapi user, like the S3 bucket, contains one folder for each environment:

/home/pmapi
├── dev
│   ├── personal_measure_api
│   └── personal_measuer_api.config.json
└── prod
    ├── personal_measure_api
    └── personal_measuer_api.config.json

As part of the automated deployment process, pmapi.jdb-labs.com has one systemd service definitions for each environment. The sudoers file allows the pmapi user to manage these without a password.

# Allow pmapi to manage the personal_measure_api service
pmapi ALL=NOPASSWD: /bin/systemctl stop personal_measure_api.prod.service
pmapi ALL=NOPASSWD: /bin/systemctl start personal_measure_api.prod.service
pmapi ALL=NOPASSWD: /bin/systemctl stop personal_measure_api.dev.service
pmapi ALL=NOPASSWD: /bin/systemctl start personal_measure_api.dev.service

Database

razgriz-db.jdb-labs.com RDS instance maintains databases for each environment:

  • dev: personal_measure_dev
  • prod: personal_measure

Routing

CloudFront manages the routing of all of the external facing URLs.

https://pm.jdb-labs.com (CloudFront)
  └── s3://pm.jdb-labs.com/prod/webroot (static HTML)

https://pm-dev.jdb-labs.com (CloudFront)
  └── s3://pm.jdb-labs.com/dev/webroot (static HTML)