Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to actions #46

Merged
merged 4 commits into from
Mar 20, 2024
Merged
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
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Continuous Integration

on:
push:

env:
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
APP_ID: ${{ secrets.APP_ID }}
ENV_ID: ${{ secrets.ENV_ID }}
CONFIG_ID: ${{ secrets.CONFIG_ID }}

jobs:
test:
name: Test and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Unit tests
run: docker-compose -f "action-services.yml" run app bash -c "./scripts/test.sh"

- name: Deploy lambda
if: github.ref_name == 'main'
run: docker-compose -f "action-services.yml" run app
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bash:
docker-compose run --rm app bash

test:
docker-compose run --rm app ./codeship/test.sh
docker-compose run --rm app ./scripts/test.sh

clean:
docker-compose kill
Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# cloudflare-scanner

Look through Cloudflare records to find the ones that contain a certain substring in their name and
then send emails with that list via AWS SES.

## Credential Rotation

### AWS Serverless User

1. Copy the aes key from Codeship
2. Paste it in a new file `codeship.aes`
3. Run `jet decrypt aws.env.encrypted aws.env`
4. (Optional) Compare the key in `aws.env` with the key in the most recent Terraform Cloud output
5. Use the Terraform CLI to taint the old access key
6. Run a new plan on Terraform Cloud
7. Review the new plan and apply if it is correct
8. Copy the new key and secret from the Terraform output into the aws.env file, overwriting the old values
9. Run `jet encrypt aws.env aws.env.encrypted`
10. Commit the new `aws.env.encrypted` file on the `develop` branch and push it to Github
11. Submit a PR to release the change to the `main` branch
1. Use the Terraform CLI to taint the old access key
2. Run a new plan on Terraform Cloud
3. Review the new plan and apply if it is correct
4. Copy the new key and secret from the Terraform output into Github Repository Secrets, overwriting the old values
5. Manually rerun the most recent workflow run on the main branch

### Cloudflare

Expand Down
16 changes: 16 additions & 0 deletions action-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3"

services:
app:
build: .
environment:
AWS_REGION: $AWS_REGION
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
APP_ID: $APP_ID
ENV_ID: $ENV_ID
CONFIG_ID: $CONFIG_ID
volumes:
- ./:/app
working_dir: /app
command: bash -c "scripts/deploy-prod.sh"
2 changes: 0 additions & 2 deletions aws.env.encrypted

This file was deleted.

11 changes: 0 additions & 11 deletions aws.env.example

This file was deleted.

6 changes: 0 additions & 6 deletions codeship-services.yml

This file was deleted.

9 changes: 0 additions & 9 deletions codeship-steps.yml

This file was deleted.

7 changes: 2 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
version: "3"

services:

app:
build:
context: ./
dockerfile: Dockerfile
build: .
env_file:
- aws.env
volumes:
- ./:/app
working_dir: /app
command: bash -c "codeship/build.sh"
command: bash -c "scripts/build.sh"
File renamed without changes.
File renamed without changes.
File renamed without changes.