Compare commits

..

No commits in common. "be60c6a506c94bfd380850b538e1d544b81fe0d3" and "f47f9828a365f8758d6d5655da8f772f8bc19798" have entirely different histories.

2 changed files with 52 additions and 73 deletions

View File

@ -6,38 +6,32 @@ env:
DOCKER_HOST: tcp://127.0.0.1:2375
jobs:
test:
strategy:
matrix:
arch:
- x86_64
# arm64
name: Test Application
runs-on: docker-${{ matrix.arch }}
container:
image: docker:dind
privileged: true
steps:
- name: Environment Setup
run: |
# If we have a proxy use it
if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
# Some pre-reqs
apk add git nodejs npm
## Some debugging info
# env|sort
- name: Code Checkout
uses: actions/checkout@v4
- name: Build Assets
run: |
# Build assets
npm i
npm run prod
# test:
# strategy:
# matrix:
# arch:
# - x86_64
# # arm64
#
# name: Test Application
# runs-on: docker-${{ matrix.arch }}
# container:
# image: docker:dind
# privileged: true
#
# steps:
# - name: Environment Setup
# run: |
# # If we have a proxy use it
# if [ -n "${HTTP_PROXY}" ]; then echo "HTTP PROXY [${HTTP_PROXY}]"; sed -i -e s'/https/http/' /etc/apk/repositories; fi
# # Some pre-reqs
# apk add git nodejs npm
# ## Some debugging info
# # env|sort
#
# - name: Code Checkout
# uses: actions/checkout@v4
#
# - name: Run Tests
# run: |
# mv .env.testing .env
@ -49,32 +43,19 @@ jobs:
# php artisan key:generate
# php artisan migrate
# php artisan db:seed
# # Build assets
# npm i
# npm run prod
# # run laravel tests
# # XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text --colors=never
- name: Cache page assets
id: cache-page-assets
uses: actions/cache@v3
env:
cache-name: page-assets
with:
path: |
public/css/app.css
key:
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
build:
strategy:
matrix:
arch:
- x86_64
- arm64
needs: [test]
# needs: [test]
name: Build Docker Image
runs-on: docker-${{ matrix.arch }}
@ -114,12 +95,11 @@ jobs:
- name: Code Checkout
uses: actions/checkout@v4
- if: ${{ steps.cache-page-assets.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
- name: Build Assets
run: |
ls -al
ls -al public/css/
# Build assets
npm i
npm run prod
- name: Record version and Delete Unnecessary files
run: |

View File

@ -6,12 +6,8 @@ env=${APP_ENV:-production}
php=${PHP_DIR:-/var/www/html}
composer=${COMPOSER_HOME:-/var/cache/composer}
RUN_USER=$(id -u -n)
SITE_USER=${SITE_USER:-www-data}
MEMCACHED_START=${MEMCACHED_START:-FALSE}
[ "${RUN_USER}" = "deon" ] && USE_SU=1
(( [ -n "${USE_SU}" ] && echo su ${SITE_USER} -s /bin/sh -c command ${USE_SU} ) || echo comman ${USE_SU}) && echo extra command
exit 1
# To run a local queue, running jobs from the queue "hostname"
LOCAL_QUEUE=${LOCAL_QUEUE:-FALSE}
@ -91,8 +87,7 @@ if [ -r artisan -a -e ${php}/.env ]; then
[ -n "${FORCE_PERMS}" -o "${env}" != "local" -a -z "${SKIP_PERM}" ] && chmod g+w ${php}
fi
CMD="composer install --optimize-autoloader ${NODEV}"
(( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}) && ( test -e .composer.refresh && rm -f .composer.refresh )
su ${SITE_USER} -s /bin/sh -c "composer install --optimize-autoloader ${NODEV}" && ( test -e .composer.refresh && rm -f .composer.refresh )
[ -n "${FORCE_PERMS}" -o "${env}" != "local" -a -z "${SKIP_PERM}" ] && [ ${mp} -eq 0 ] && chmod g-w ${php}
fi
@ -100,8 +95,7 @@ if [ -r artisan -a -e ${php}/.env ]; then
mp=$(mp ${php})
if [ ${mp} -eq 1 ]; then
echo " - Caching configuration..."
CMD="php artisan optimize"
( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}
su ${SITE_USER} -s /bin/sh -c "(php artisan optimize)"
fi
if [ "${role}" = "app" ]; then
@ -114,8 +108,7 @@ if [ -r artisan -a -e ${php}/.env ]; then
wait_for_db
CMD="php artisan migrate"
(( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}) && rm -f .migrate
su ${SITE_USER} -s /bin/sh -c "php artisan migrate" && rm -f .migrate
fi
else
[ -r .migrate ] && echo "! NOTE: Migration ignored due to IGNORE_MIGRATION"
@ -125,20 +118,20 @@ if [ -r artisan -a -e ${php}/.env ]; then
if [ -d ${php}/vendor/laravel/passport ]; then
echo " - Generating OAUTH keys ..."
set +e
CMD="php artisan passport:keys"
( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}
su ${SITE_USER} -s /bin/sh -c "php artisan passport:keys"
set -e
fi
fi
if [ "${LOCAL_QUEUE}" = "TRUE" ]; then
echo " - Starting local queue for [$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}}] with job timeout of [${WORK_TIMEOUT:-90}], trying [${WORK_TRIES:-1}] times..."
CMD="(while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) &"
( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}
su ${SITE_USER} -s /bin/sh -c "
(while true; do php ${PHP_OPTIONS} artisan queue:work --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} --queue=$(hostname)${LOCAL_QUEUES:+,${LOCAL_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done) &
"
fi
set +e
[ -x init-php.sh ] && (( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "init-php.sh &" ) || init-php.sh &)
[ -x init-php.sh ] && su ${SITE_USER} -s /bin/sh "init-php.sh" &
exec /usr/local/bin/docker-php-entrypoint "$@"
@ -155,16 +148,22 @@ if [ -r artisan -a -e ${php}/.env ]; then
wait_for_db
CMD="while true; do php ${PHP_OPTIONS} artisan queue:${QUEUE_CMD} --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}; done"
( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}
su ${SITE_USER} -s /bin/sh -c "
while true; do
php ${PHP_OPTIONS} artisan queue:${QUEUE_CMD} --verbose --tries=${WORK_TRIES:-1} --timeout=${WORK_TIMEOUT:-90} ${WORK_QUEUES:+--queue=${WORK_QUEUES}} ${WORK_MEMORY:+--memory=${WORK_MEMORY}} ${WORK_ONCE:+--once}
done
"
elif [ "$role" = "scheduler" ]; then
echo " - Running the scheduler..."
# We'll delay starting in case the app is caching
sleep 15
CMD="while true; do php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction; done"
( [ -n "${USE_SU}" ] && su ${SITE_USER} -s /bin/sh -c "${CMD}" ) || ${CMD}
su ${SITE_USER} -s /bin/sh -c "
while true; do
php ${PHP_OPTIONS} artisan schedule:work --verbose --no-interaction
done
"
fi
else