Created
October 21, 2024 04:42
-
-
Save halberom/2081e2652617a973af4db049a66f4d1f to your computer and use it in GitHub Desktop.
goss troubleshooting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build -t test . | |
docker run --rm -it --name test test | |
# in another terminal | |
while true; do curl -I localhost:8080/healthz; sleep 5; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ghcr.io/goss-org/goss as goss | |
FROM python | |
COPY --from=goss /usr/bin/goss /usr/bin/goss | |
WORKDIR /app | |
COPY goss.yaml . | |
COPY main.py . | |
COPY --chmod=755 entrypoint.sh . | |
EXPOSE 5000 | |
ENTRYPOINT ["./entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
goss -g ./goss.yaml serve --loglevel ERROR & | |
python ./main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
process: | |
python: | |
running: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import urllib.request | |
import urllib.error | |
def uptime_bot(url): | |
while True: | |
try: | |
_ = urllib.request.urlopen(url) | |
print("Website is up!") | |
except urllib.error.HTTPError: | |
print("Website is down!") | |
except urllib.error.URLError: | |
print("Website is down!") | |
time.sleep(5) | |
if __name__ == "__main__": | |
url = "http://www.google.com" | |
uptime_bot(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Website is up! | |
Website is up! | |
Website is up! | |
2024-10-21T04:41:20Z Stale cache[res], running tests | |
Website is up! | |
2024-10-21T04:41:25Z Stale cache[res], running tests | |
Website is up! | |
2024-10-21T04:41:31Z Stale cache[res], running tests | |
Website is up! | |
2024-10-21T04:41:36Z Stale cache[res], running tests | |
Website is up! | |
2024-10-21T04:41:41Z Stale cache[res], running tests | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment