Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
PR Fixes: Update README, clean up STRTA
Browse files Browse the repository at this point in the history
- Fix typos
- Update README to reflect addition of STRTA
- Remove unnecessary STRTA
- Clean up extra env variables
  • Loading branch information
tnation14 committed Aug 31, 2017
1 parent 43d12c1 commit 0e451ce
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 57 deletions.
47 changes: 22 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

### Requirements

Requires node.js 6.11+ and npm 3.10.10+ for Angular CLI compatibility.
Requires node.js 6.11+ and yarn 0.24.0+ for Angular CLI compatibility.

Alternatively, you can bring up the vagrant VM that has the dependencies installed.

### Setup

If your development host machine meets the requirements above, simply:

- Clone this repo and run `npm install`
- Clone this repo and run `yarn install`
- `cp example/constants.ts.example src/app/constants.ts`
- Edit `constants.ts` to set the API server name and API key
- `npm run serve`
- `yarn run serve`

The site will then be available at [http://localhost:4200](http://localhost:4200) on your host machine.

Expand All @@ -25,55 +25,52 @@ _Recommended only if you don't have the requirements above installed on your hos

Requires ansible 2.2+.

To use the vagrant machine, first start it with:
To use the vagrant machine, first start and provision it with:
```bash
vagrant up
./scripts/setup
```

Then to start the development server within the VM:

```bash
vagrant ssh
cd /vagrant
npm run serve:vm # Replaces `npm run serve` to include VM specific serve options
./scripts/server --vm # Replaces `npm run serve` to include VM specific serve options
```

The site will then be available at [http://localhost:4200](http://localhost:4200) on your host machine.

Note that if your host OS differs from the VM, you may need to run

```
npm rebuild node-sass
```

within the environment (host or VM) before running other build scripts in that environment.

### Getting started

| Command | Purpose | Use When ... |
|------|---------|--------------|
| `npm run serve` | Serve project in dev mode using Angular CLI | For quick browser updating with refresh |
| `npm run lint` | Run typescript linter | To clean up your angular and .ts files |
| `npm run test` | Run project tests | |
| `npm run build:prod` | Build production version of application | When ready to deploy |
| `scripts/update` | Update project dependencies | |
| `scripts/server` | Serve project in dev mode using Angular CLI | For quick browser updating with refresh |
| `scripts/test` | Run project tests | |
| `scripts/console` | Run commands inside of a container | |
| `scripts/cibuild` | Build production version of application | Before deploying |
| `scripts/infra` | Apply terraform changes and deploy static site | When ready to deploy |

Navigate to [http://localhost:4200](http://localhost:4200) in your browser.

Additional commands available in package.json.

### Deployment

_All deployment steps should be done within the vagrant vm provided with this project. The vm is provisioned with the tools necessary to deploy._

First, build the application via `npm run build:prod`. The static site will be built in the `dist/` directory.

Copy the environment file with `cp .env.example .env` and add your AWS access/secret keys and CloudFront distribution ID to it.
First, build the application via `scripts/cibuild`. The static site will be built in the `dist/_site` directory.

Before publishing, ensure the correct `apiHost` is set for the target environment in `src/app/constants.ts` (staging host, or production).

Push changes to the staging site with `s3_website push`
Push changes to the staging site with docker-compose:

To push changes to the production site, specify the production S3 configuration with:
```
s3_website push --config-dir=production_s3/
```bash
$ export CC_SETTINGS_BUCKET=staging-us-east-1-climate-lab-site
$ export CC_SITE_BUCKET=staging-us-east-1-climate-lab-config
$ docker-compose -f docker-compose.ci.yml run --rm terraform scripts/infra plan
$ docker-compose -f docker-compose.ci.yml run --rm terraform scripts/infra apply
```

To push changes to the production site, set `CC_SETTINGS_BUCKET=production-us-east-1-climate-lab-site`
and `CC_SITE_BUCKET=production-us-east-1-climate-lab-site`
26 changes: 0 additions & 26 deletions scripts/cipublish

This file was deleted.

1 change: 0 additions & 1 deletion scripts/infra
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ fi

DIR="$(dirname "$0")"

CC_ENVIRONMENT=${CC_ENVIRONMENT:-staging}
TERRAFORM_DIR="${DIR}/../deployment/terraform"
CC_SITE_BUCKET="staging-us-east-1-climate-lab-site"

Expand Down
8 changes: 6 additions & 2 deletions scripts/server
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ set -e

function usage() {
echo -n \
"Usage: $(basename "$0")
"Usage: $(basename "$0") [--vm]
Start local development server."
}

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${1:-}" = "--help" ]; then
usage
else
docker-compose run --rm app run serve:vm
if [ "${1:-}" = "--vm" ]; then
docker-compose run --rm app run serve:vm
else
docker-compose run --rm app run serve
fi
fi
fi
2 changes: 1 addition & 1 deletion scripts/update
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
# Build app container
docker-compose build app

# Updae NPM dependencies, build static assets
# Update NPM dependencies
docker-compose run --rm app install
fi
fi
2 changes: 0 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ ARG NODE_VERSION

FROM node:${NODE_VERSION}

ARG NPM_VERSION

RUN set -ex \
&& apt-get update -yq \
&& karmaDeps=' \
Expand Down

0 comments on commit 0e451ce

Please sign in to comment.