-
Notifications
You must be signed in to change notification settings - Fork 0
Module 8 #10
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
base: master
Are you sure you want to change the base?
Module 8 #10
Changes from all commits
4c4a352
53dabc2
b4e3572
b8a59f3
794c8f9
699f749
421e808
9e418f0
748aaad
4b36f1e
57eb70f
b2e7741
bbb54fd
74c10ab
a0c5e75
8afaeb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: CI Github Actions | ||
| on: | ||
| push: | ||
| branches: | ||
| - module_8 | ||
| pull_request: | ||
| branches: | ||
| - module_8 | ||
|
|
||
| jobs: | ||
|
|
||
| build: | ||
|
|
||
| name: Build and test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - run: docker build --target test --tag todo-app:test . | ||
| - run: docker run todo-app:test tests | ||
| - run: docker run -e TRELLO_API_KEY=${{ secrets.TRELLO_API_KEY }} -e TRELLO_API_SECRET=${{ secrets.TRELLO_API_SECRET }} -e TRELLO_BOARD_ID=${{ secrets.TRELLO_BOARD_ID }} todo-app:test tests_e2e | ||
|
|
||
| - name: Send status to Slack workflow | ||
| id: slack | ||
| uses: act10ns/slack@v1 | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| with: | ||
| status: ${{ job.status }} | ||
| message: "GitHub Actions Result: ${{ job.status }}\n${{ github.event.pull_request.html_url }}" | ||
|
|
||
| production: | ||
| needs: build | ||
| name: Push to DockerHub | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/module_8' && github.event_name == 'push' | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Setting up Docker Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Login to DockerHub | ||
| run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | ||
|
|
||
| - name: Push Image to DockerHub | ||
| uses: docker/build-push-action@v3 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| target: production | ||
| push: true | ||
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/todoapp:latest |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,8 +81,47 @@ ansible-playbook my-playbook.yml -i my-inventory | |
| You will be prompted for the trello api key, secret, and board ID, which you can paste in. | ||
|
|
||
| ## Docker | ||
| You can run 'docker-compose up' to create the Dev, Prod, and Test images. | ||
| The test results will output to the terminal. | ||
| You can run 'docker-compose up' to create the Dev, Prod, and Test images. The test results will output to the terminal. | ||
|
|
||
| For Prod - http://localhost | ||
| For Dev - http://localhost:5000 | ||
| For Prod - http://localhost For Dev - http://localhost:5000 | ||
|
|
||
| To run the commands manually you can use: | ||
|
|
||
| docker build --target test --tag todo-app:test . | ||
|
|
||
| docker run todo-app:test tests | ||
| docker run --env-file .env todo-app:test tests_e2e | ||
|
|
||
| ## Secrets | ||
| You must define the following secrets in GitHub Secrets section: | ||
|
|
||
| For the board to work: | ||
| TRELLO_API_KEY | ||
| TRELLO_API_SECRET | ||
| TRELLO_BOARD_ID | ||
|
|
||
| For slack notifications: | ||
| SLACK_WEBHOOK_URL | ||
| From thew Incoming WebHooks app in the slack app directory. | ||
|
|
||
| For DockerHub | ||
| DOCKERHUB_PASSWORD | ||
| DOCKERHUB_USERNAME | ||
|
|
||
| ## Heroku: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the clear instructions! |
||
| My app name is | ||
| https://markdossantos-module8.herokuapp.com/ | ||
|
|
||
| To deploy to Heroku from DockerHub you will need to retag the Image: | ||
| docker tag <username/project:tag> registry.heroku.com/<Heroku_App_Name>/web | ||
|
|
||
| Push the image to DockerHub | ||
| docker push registry.heroku.com/<Heroku_App_Name>/web | ||
|
|
||
| Release the application | ||
| heroku container:release web -a <Heroku_App_Name> | ||
|
|
||
| For automation in your CI pipeline you will need to create an API key with: | ||
| heroku authorizations:create | ||
| And save the key in Github Secrets as: | ||
| HEROKU_API_KEY | ||
|
Comment on lines
+126
to
+127
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to imply your pipeline can handle deploying to Heroku, but I can't see any evidence it tries to do that? We do (did) want to do that as part of the pipeline, but since Heroku is going to lose the free tier very shortly I recommend we skip it and just set up an equivalent to Azure as part of M9 |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but here you've swapped the default port from 80 to 5000 for your prod container, which might mean old instructions (including port mappings in your docker-compose file) are no longer accurate