Skip to content

Commit

Permalink
added container persistence for dev container; plus readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
suprjinx committed Aug 23, 2024
1 parent 9caebcf commit 20a3376
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ on:
branches: [ main ]

jobs:

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and run Dev Container task
uses: devcontainers/[email protected]
with:
# Change this to point to your image name
imageName: ghcr.io/gresearch/astral-devcontainer
# Change this to be your CI task/script
runCmd: |
# Add multiple commands to run if needed
bundle install
scan_ruby:
runs-on: ubuntu-latest

Expand All @@ -16,6 +34,7 @@ jobs:
- name: Run brakeman
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/gresearch/astral-devcontainer
runCmd: bin/brakeman --no-pager

lint:
Expand Down Expand Up @@ -49,6 +68,7 @@ jobs:
- name: Run tests
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/gresearch/astral-devcontainer
runCmd: bin/rails test

- name: Keep screenshots from failed system tests
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# README

Astral-rails is a proof-of-concept api application intended to simplify
Astral is an api-only application intended to simplify
certificate acquisition for other applications/services. Broadly speaking,
it will:

Expand All @@ -10,16 +10,20 @@ it will:

# Running

This app is most easily run and developed in its devcontainer.
This Rails app is most easily run and developed in its devcontainer.

1) Open in devcontainer
2) Launch server using vscode launch config, or in terminal run:
```
rails s
```
3) POST /certificates to acquire cert in terminal:
3) POST /certificates to acquire cert in another terminal (need to provide `common_name` param):
```
curl -X POST http://localhost:3000/certificates \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBsaWNhdGlvbl9uYW1lIiwiY29tbW9uX25hbWUiOiJleGFtcGxlLmNvbSIsImlwX3NhbnMiOiIxMC4wLjEuMTAwIn0.61e0oQIj7vwGtOpFuPJDCI_Bqf8ZTpJxe_2kUwcbN7Y"
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBsaWNhdGlvbl9uYW1lIiwiY29tbW9uX25hbWUiOiJleGFtcGxlLmNvbSIsImlwX3NhbnMiOiIxMC4wLjEuMTAwIn0.61e0oQIj7vwGtOpFuPJDCI_Bqf8ZTpJxe_2kUwcbN7Y" \
-H "Content-type: application/json" -d '{ "common_name": "example.com" }'
```
4) Run the tests from devcontainer terminal:
```
rails test
```

0 comments on commit 20a3376

Please sign in to comment.