This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webapp oci):initial version of webapp image
feat(github-actions): build webapp image feat(github-actions): build webapp image update docs, include a script to run tests based on env vars fixup! feat(github-actions): build webapp image use an entrypoint script that starts a cronjob to run every minute ci: attempt to have 2 tags for the webapp image, one with the sha fixup! feat(webapp oci):initial version of webapp image fixup! use an entrypoint script that starts a cronjob to run every minute fixup! use an entrypoint script that starts a cronjob to run every minute fixup! ci: attempt to have 2 tags for the webapp image, one with the sha tasks to run webapp image locally ci: fix gh actions invalid workflow file error debug logs on the entrypoint shell script fixup! ci: fix gh actions invalid workflow file error run the test delete-objects every 20 minutes change test frequency to every 3 minutes change timezone and add output of tests to the smile txt wip
- Loading branch information
Showing
11 changed files
with
201 additions
and
14 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ config.yaml | |
results | ||
venv | ||
mgc | ||
nginx.conf | ||
!src/templates/nginx.conf |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
set +x | ||
|
||
# Check if CONFIG_YAML_CONTENT is present | ||
if [ -z "$CONFIG_YAML_CONTENT" ]; then | ||
echo "Error: CONFIG_YAML_CONTENT environment variable is not set." | ||
printf ":-(\n\nError: CONFIG_YAML_CONTENT environment variable is not set. $(date)" > /app/results/smile.txt | ||
exit 1 | ||
fi | ||
|
||
# create config.yaml file from env var | ||
echo "$CONFIG_YAML_CONTENT" > /app/config.yaml | ||
|
||
# create ~/.aws config files | ||
just _setup | ||
|
||
# space separated list of remote names | ||
remotes=$(dasel -f /app/config.yaml -r yaml -s '.remotes.all().key()' | grep -v '\-second$' | tr '\n' ' ') | ||
|
||
echo "Remotes: $remotes" | ||
date | ||
for remote in $remotes; do | ||
echo "Executing AWS CLI command for profile $remote" | ||
echo "$remote" >> /app/results/smile.txt | ||
aws s3api list-buckets --cli-connect-timeout 2 --cli-read-timeout 2 --profile "$remote" >> /app/results/smile.txt | ||
done | ||
|
||
# # run a small test (delete-objects) on all remotes to assure that the reports are being written in the correct place | ||
# just group-test delete-objects _all "$remotes" | ||
|
||
# asure that results folder is readable | ||
chmod -R 755 results | ||
|
||
# Create a cron job that runs three times a day | ||
echo "50 0,8,16 * * * /app/run_tests.sh" > /etc/crontabs/root | ||
|
||
# Start cron | ||
crond -f & | ||
|
||
# Start Nginx | ||
exec nginx -g 'daemon off;' | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
set +x | ||
|
||
# cron job starts on /root and is run by user root | ||
cd /app | ||
|
||
touch results/debug_last_test_start | ||
|
||
# space separated list of remote names | ||
remotes=$(dasel -f /app/config.yaml -r yaml -s '.remotes.all().key()' | grep -v '\-second$' | tr '\n' ' ') | ||
|
||
just group-test index-s3 _all "$remotes" > results/debug_last_test.txt 2>&1 | ||
|
||
# asure that results folder is readable | ||
chmod -R 755 results | ||
|
||
printf ":-)\n\nLast test ended on $(date)" > results/smile.txt |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Set number of worker processes automatically based on number of CPU cores. | ||
worker_processes auto; | ||
|
||
events { | ||
# The maximum number of simultaneous connections that can be opened by | ||
# a worker process. | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
charset utf-8; | ||
|
||
server { | ||
listen {{ .webapp.nginx.listen }}; | ||
server_name {{ .webapp.nginx.server_name }}; | ||
|
||
{{- range $location_name, $location := .webapp.nginx.locations}} | ||
location {{ $location_name }} { | ||
root {{ $location.root }}; | ||
index index.html; | ||
autoindex on; | ||
autoindex_localtime on; | ||
} | ||
{{- end}} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Use main image as base | ||
FROM ghcr.io/marmotitude/object-storage-tests:main | ||
|
||
# Install Nginx and cron | ||
RUN apk update && \ | ||
apk add --no-cache nginx dcron tzdata | ||
|
||
# Set the timezone to America/Sao_Paulo | ||
RUN ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime && \ | ||
echo "America/Sao_Paulo" > /etc/timezone | ||
|
||
# Keep a backup of alpine's default nginx config | ||
RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig | ||
|
||
# Copy our custom Nginx configuration | ||
COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Set the working directory to /app | ||
WORKDIR /app | ||
|
||
# Create the directory for the results | ||
RUN mkdir -p results | ||
|
||
# Set ownership and permissions for Nginx to read from /app/results | ||
RUN chown -R root:root results && \ | ||
chmod -R 755 results | ||
|
||
# Write dummy file to results directory with a smile and timestamp | ||
RUN printf ":-)\n\nBuilt on $(date) by:$(hostname)" > results/smile.txt | ||
|
||
# Copy the shell script that runs desired tests outputing to results folder | ||
# this script will be executed by an external scheduler periodically | ||
COPY run_tests.sh /app/run_tests.sh | ||
|
||
# Expose port 5000 | ||
EXPOSE 5000 | ||
|
||
COPY justfile /app/justfile | ||
|
||
# Copy the entrypoint script | ||
COPY entrypoint.sh /app/entrypoint.sh | ||
|
||
# Make the script executable | ||
RUN chmod +x /app/entrypoint.sh | ||
|
||
# Set the ENTRYPOINT to the script | ||
ENTRYPOINT ["/app/entrypoint.sh"] |