diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 709c9834..354c4752 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: php-version: ${{ matrix.php-version }} tools: composer - run: composer install --no-interaction --prefer-dist - - run: ./vendor/bin/rr get --location bin/ && chmod +x bin/rr + - run: ./vendor/bin/rr get --no-interaction --location bin/ && chmod +x bin/rr - run: composer test:api:rr cli-tests: diff --git a/Dockerfile b/Dockerfile index bc0f4fe2..2835d75f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,7 +60,7 @@ LABEL maintainer="Alejandro Celaya " COPY --from=builder /etc/shlink . RUN ln -s /etc/shlink/bin/cli /usr/local/bin/shlink && \ if [ "$SHLINK_RUNTIME" == 'rr' ]; then \ - php ./vendor/bin/rr get --location bin/ && chmod +x bin/rr ; \ + php ./vendor/bin/rr get --no-interaction --location bin/ && chmod +x bin/rr ; \ fi; # Expose default port diff --git a/config/roadrunner/.rr.dev.yml b/config/roadrunner/.rr.dev.yml index df6e2993..a12f2475 100644 --- a/config/roadrunner/.rr.dev.yml +++ b/config/roadrunner/.rr.dev.yml @@ -9,19 +9,14 @@ server: http: address: '0.0.0.0:8080' static: - dir: ../../public - forbid: - - .php - - .htaccess + dir: '../../public' + forbid: ['.php', '.htaccess'] pool: - num_workers: 3 - supervisor: - max_worker_memory: 100 + num_workers: 16 jobs: pool: - num_workers: 2 - max_worker_memory: 100 + num_workers: 16 timeout: 300 consume: ['shlink'] pipelines: diff --git a/config/roadrunner/.rr.yml b/config/roadrunner/.rr.yml index 032989b9..f7409c48 100644 --- a/config/roadrunner/.rr.yml +++ b/config/roadrunner/.rr.yml @@ -7,22 +7,17 @@ server: command: 'php -dopcache.enable_cli=1 -dopcache.validate_timestamps=0 ../../bin/roadrunner-worker.php' http: - address: '0.0.0.0:8080' + address: '0.0.0.0:${PORT}' static: - dir: ../../public - forbid: - - .php - - .htaccess + dir: '../../public' + forbid: ['.php', '.htaccess'] pool: - num_workers: 16 # TODO Make configurable - supervisor: - max_worker_memory: 100 + num_workers: ${WEB_WORKER_NUM} jobs: - timeout: 300 + timeout: 300 # 5 minutes pool: - num_workers: 16 # TODO Make configurable - max_worker_memory: 100 + num_workers: ${TASK_WORKER_NUM} consume: ['shlink'] pipelines: shlink: diff --git a/data/infra/roadrunner.Dockerfile b/data/infra/roadrunner.Dockerfile index 7a68a7ae..8520b92d 100644 --- a/data/infra/roadrunner.Dockerfile +++ b/data/infra/roadrunner.Dockerfile @@ -68,6 +68,6 @@ CMD \ # Install dependencies if the vendor dir does not exist if [[ ! -d "./vendor" ]]; then /usr/local/bin/composer install ; fi && \ # Download roadrunner binary - if [[ ! -f "./bin/rr" ]]; then ./vendor/bin/rr get --location bin/ && chmod +x bin/rr ; fi && \ + if [[ ! -f "./bin/rr" ]]; then ./vendor/bin/rr get --no-interaction --location bin/ && chmod +x bin/rr ; fi && \ # This forces the app to be started every second until the exit code is 0 until ./bin/rr serve -c config/roadrunner/.rr.dev.yml; do sleep 1 ; done diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c191afe7..a1cc03be 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -31,6 +31,11 @@ if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then /usr/sbin/crond & fi +# RoadRunner config needs these to have been set, so falling back to default values if not set yet +export PORT="${PORT:-"8765"}" +export WEB_WORKER_NUM="${WEB_WORKER_NUM:-"16"}" +export TASK_WORKER_NUM="${TASK_WORKER_NUM:-"16"}" + if [ "$SHLINK_RUNTIME" == 'openswoole' ]; then # When restarting the container, openswoole might think it is already in execution # This forces the app to be started every second until the exit code is 0