Skip to content

Commit

Permalink
Check app status and display logs via ruby script
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Dec 4, 2024
1 parent 2b17862 commit 636d8e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ jobs:
run: docker compose --file docker-compose.yml --file docker-compose.build.yml up --build --detach --wait
continue-on-error: true
- name: Wait and check containers
run: sleep 300 && docker ps -a
run: sleep 120 && docker ps -a
continue-on-error: true
- name: Check app status
run: |
curl -o _curl_output.txt -s http://localhost:3000/statistics/application_status
\[ "`cat _curl_output.txt`" == "FAIRDOM-SEEK is running | search is enabled | 7 delayed jobs running" \]
- name: Check docker logs & curl output
if: failure()
run: |
docker compose --file docker-compose.yml --file docker-compose.build.yml logs
cat _curl_output.txt
run: ruby script/check_deployment.rb
12 changes: 12 additions & 0 deletions script/check_deployment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
output = `curl --verbose --silent http://localhost:3000/ 2>&1`
if $?.success? && output.include?('FAIRDOM-SEEK is running | search is enabled | 7 delayed jobs running')
exit 0
else
puts "::group::Docker logs"
puts `docker compose --file docker-compose-prod.yml logs`
puts "::endgroup::"
puts "::group::curl output"
puts output
puts "::endgroup::"
exit 1
end

0 comments on commit 636d8e4

Please sign in to comment.