-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #685 from henrywhitaker3/fix/680/last-x-days
#680: Fix issue where the data would refresh before the react state had updated
- Loading branch information
Showing
16 changed files
with
681 additions
and
161,189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
.vscode/ | ||
|
||
_ide_helper.php | ||
.idea | ||
.config | ||
reports/ |
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
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,11 @@ | ||
FROM linuxserver/nginx | ||
LABEL maintainer=henrywhitaker3@outlook.com | ||
|
||
ENV arch='x86_64' | ||
|
||
COPY docker/conf/ / | ||
COPY . /site | ||
|
||
EXPOSE 80 443 | ||
|
||
VOLUME ["/config"] |
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,10 @@ | ||
FROM linuxserver/nginx:arm32v7-latest | ||
LABEL maintainer=henrywhitaker3@outlook.com | ||
|
||
ENV arch='arm' | ||
|
||
COPY conf/ / | ||
|
||
EXPOSE 80 443 | ||
|
||
VOLUME ["/config"] |
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,10 @@ | ||
# do daily/weekly/monthly maintenance | ||
# min hour day month weekday command | ||
*/15 * * * * run-parts /etc/periodic/15min | ||
0 * * * * run-parts /etc/periodic/hourly | ||
0 2 * * * run-parts /etc/periodic/daily | ||
0 3 * * 6 run-parts /etc/periodic/weekly | ||
0 5 1 * * run-parts /etc/periodic/monthly | ||
# speedtest cron | ||
* * * * * php /config/www/artisan schedule:run >> /config/log/speedtest/cron.log | ||
# */5 * * * * php /config/www/artisan queue:retry all >> /config/log/speedtest.cron.log |
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,30 @@ | ||
server { | ||
listen 80 default_server; | ||
|
||
listen 443 ssl; | ||
|
||
root /config/www/public; | ||
index index.html index.htm index.php; | ||
|
||
server_name _; | ||
|
||
ssl_certificate /config/keys/cert.crt; | ||
ssl_certificate_key /config/keys/cert.key; | ||
|
||
client_max_body_size 0; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php?$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
# With php5-cgi alone: | ||
fastcgi_pass 127.0.0.1:9000; | ||
# With php5-fpm: | ||
#fastcgi_pass unix:/var/run/php5-fpm.sock; | ||
fastcgi_index index.php; | ||
include /etc/nginx/fastcgi_params; | ||
|
||
} | ||
} |
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,138 @@ | ||
#!/usr/bin/with-contenv bash | ||
# # This script sets up the speedtest app | ||
|
||
function eulaError() | ||
{ | ||
echo "##################################################################################################################################" | ||
echo "##################################################################################################################################" | ||
echo "You haven't accepted the Ookla EULA. Please re-create the container with the environment variable 'OOKLA_EULA_GDPR' set to 'true'." | ||
echo "##################################################################################################################################" | ||
echo "##################################################################################################################################" | ||
exit 1 | ||
} | ||
|
||
# Do Ookla stuff | ||
if [ -z ${OOKLA_EULA_GDPR+x} ]; then | ||
eulaError | ||
else | ||
if [ $OOKLA_EULA_GDPR != "true" ]; then | ||
eulaError | ||
fi | ||
|
||
if [ ! -f /config/www/app/Bin/speedtest ]; then | ||
echo "Ookla GDPR and EULA accepted. Downloading Speedtest CLI." | ||
cd /tmp | ||
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-$arch-linux.tgz -O speedtest.tgz > /dev/null | ||
tar zxvf speedtest.tgz > /dev/null | ||
cp speedtest /site/app/Bin/ | ||
|
||
HOME=/config && s6-setuidgid abc /site/artisan speedtest:eula > /dev/null | ||
HOME=/root | ||
else | ||
HOME=/config && s6-setuidgid abc /config/www/artisan speedtest:eula > /dev/null | ||
HOME=/root | ||
fi | ||
fi | ||
|
||
# Copy site files to /config | ||
echo "Copying latest site files to config" | ||
cp -rfT /site/ /config/www/ | ||
|
||
# Check for DB | ||
if [ ! -f /config/speed.db ]; then | ||
echo "Database file not found! Creating empty database" | ||
touch /config/speed.db | ||
else | ||
echo "Database file exists" | ||
chown abc:abc /config/speed.db | ||
fi | ||
|
||
# Check for .env | ||
if [ ! -f /config/www/.env ]; then | ||
echo "Env file not found! Creating .env file" | ||
cp /site/.env.example /config/www/.env | ||
else | ||
echo "Env file exists" | ||
fi | ||
|
||
if [ ! -f /config/www/.composer-time ]; then | ||
echo 'Removing old packages' | ||
rm -rf /config/www/vendor/ | ||
fi | ||
|
||
echo 'Updating packages' | ||
apk add composer | ||
cd /config/www && composer install && echo date > /config/www/.composer-time | ||
|
||
sed "s,DB_DATABASE=.*,DB_DATABASE=/config/speed.db," -i.bak /config/www/.env | ||
|
||
echo "Running database migrations" | ||
php /config/www/artisan migrate | ||
|
||
# Check app key exists | ||
if grep -E "APP_KEY=[0-9A-Za-z:+\/=]{1,}" /config/www/.env > /dev/null; then | ||
echo "App key exists" | ||
else | ||
echo "Generating app key" | ||
php /config/www/artisan key:generate | ||
fi | ||
|
||
# Check JWT secret exists | ||
if grep -E "JWT_SECRET=[0-9A-Za-z:+\/=]{1,}" /config/www/.env > /dev/null ; then | ||
echo "JWT secret exists" | ||
else | ||
echo "Generating JWT secret" | ||
php /config/www/artisan jwt:secret | ||
fi | ||
|
||
if [ -z ${SLACK_WEBHOOK+x} ]; then | ||
echo "Slack webhook is unset" | ||
sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=," -i.bak /config/www/.env | ||
else | ||
echo "Slack webhook set, updating db" | ||
sed "s,SLACK_WEBHOOK=.*,SLACK_WEBHOOK=$SLACK_WEBHOOK," -i.bak /config/www/.env | ||
php /config/www/artisan speedtest:slack $SLACK_WEBHOOK | ||
fi | ||
|
||
if [ -z ${TELEGRAM_BOT_TOKEN+x} ] && [ -z ${TELEGRAM_CHAT_ID+x} ]; then | ||
echo "Telegram chat id and bot token unset" | ||
sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=," -i.bak /config/www/.env | ||
sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=," -i.bak /config/www/.env | ||
else | ||
echo "Telegram chat id and bot token set, updating .env" | ||
sed "s,TELEGRAM_BOT_TOKEN=.*,TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN," -i.bak /config/www/.env | ||
sed "s,TELEGRAM_CHAT_ID=.*,TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID," -i.bak /config/www/.env | ||
php /config/www/artisan speedtest:telegram --chat=$TELEGRAM_CHAT_ID --bot=$TELEGRAM_BOT_TOKEN | ||
fi | ||
|
||
if [ -z ${BASE_PATH+x} ]; then | ||
echo "Base path is unset" | ||
sed "s,BASE_PATH=.*,BASE_PATH=," -i.bak /config/www/.env | ||
else | ||
echo "Base path set, updating .env" | ||
sed "s,BASE_PATH=.*,BASE_PATH=$BASE_PATH," -i.bak /config/www/.env | ||
fi | ||
|
||
if [ -z ${AUTH+x} ]; then | ||
echo "AUTH variable not set. Disabling authentication" | ||
php /config/www/artisan speedtest:auth --disable | ||
else | ||
if [ $AUTH == 'true' ]; then | ||
echo "AUTH variable set. Enabling authentication" | ||
php /config/www/artisan speedtest:auth --enable | ||
else | ||
echo "AUTH variable set, but not to 'true'. Disabling authentication" | ||
php /config/www/artisan speedtest:auth --disable | ||
fi | ||
fi | ||
|
||
echo "Clearing old jobs from queue" | ||
php /config/www/artisan queue:clear | ||
|
||
mkdir -p /config/log/speedtest | ||
|
||
cp /defaults/crontab /etc/crontabs/root | ||
|
||
chown -R abc:abc /config | ||
chmod +x /config/www/app/Bin/speedtest | ||
chmod -R 777 /config/www/storage/clockwork |
Oops, something went wrong.