Skip to content

Commit ba42ab3

Browse files
committed
fix: install scripts
1 parent 4fab1fc commit ba42ab3

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ indent_size = 2
2020
indent_style = space
2121
indent_size = 2
2222
trim_trailing_whitespace = true
23+
24+
[Makefile]
25+
indent_style = tab
26+
indent_size = 4

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
installer:
2+
@docker build -f build/installer/Dockerfile -t ghcr.io/phpquant/stochastix-installer .
3+
4+
app:
5+
@docker build -f build/app.Dockerfile -t ghcr.io/phpquant/stochastix --target frankenphp_dev .

build/installer/install.sh

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ if [ -d "$PROJECT_PATH" ]; then
2424
fi
2525

2626
echo "Creating new Stochastix project in './${PROJECT_NAME}'..."
27-
mkdir -p "$PROJECT_PATH"
28-
mkdir -p "$PROJECT_PATH/frankenphp"
27+
mkdir -p "$PROJECT_PATH/frankenphp/conf.d"
2928

3029
# Copy the template files from the image into the new project directory
3130
echo "Scaffolding project files..."
@@ -37,13 +36,14 @@ cp /templates/frankenphp/Caddyfile "${PROJECT_PATH}/frankenphp/Caddyfile"
3736
cp /templates/frankenphp/conf.d/20-app.dev.ini "${PROJECT_PATH}/frankenphp/conf.d/20-app.dev.ini"
3837

3938
echo "✅ Project files created."
40-
echo "🚀 Launching Stochastix application... (This may take a minute on the first run)"
39+
echo "🚀 Installing Stochastix... (This may take 3 to 10 minutes depending on your internet connection)"
4140

4241
# Use the mounted Docker socket to run docker-compose on the host machine,
4342
# specifying the project directory for context.
44-
docker compose -p "${PROJECT_NAME}" -f "${PROJECT_PATH}/compose.yaml" up --wait
43+
docker run --rm -it -v "${PROJECT_NAME}:/app" ghcr.io/phpquant/stochastix:latest php --version
44+
docker compose -p "${PROJECT_NAME}" -f "${PROJECT_PATH}/compose.yaml" up -d
4545

4646
echo
4747
echo "✅ Stochastix is running!"
48-
echo "You can now access the UI at https://localhost (or the host you configured)."
48+
echo "You can now access the UI at https://localhost."
4949
echo

templates/compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ services:
2121
messenger-worker:
2222
image: ghcr.io/phpquant/stochastix:latest
2323
restart: unless-stopped
24+
environment:
25+
MERCURE_URL: ${CADDY_MERCURE_URL:-http://php/.well-known/mercure}
26+
MERCURE_PUBLIC_URL: ${CADDY_MERCURE_PUBLIC_URL:-https://${SERVER_NAME:-localhost}:${HTTPS_PORT:-443}/.well-known/mercure}
27+
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!}
2428
volumes:
2529
- ./:/app
2630
command: php bin/console messenger:consume stochastix --limit=10 -vv

templates/frankenphp/docker-entrypoint.sh

100644100755
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,34 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
66
# After the installation, the following block can be deleted
77
if [ ! -f composer.json ]; then
88
rm -Rf tmp/
9-
composer create-project "symfony/skeleton $SYMFONY_VERSION" tmp --stability="$STABILITY" --prefer-dist --no-progress --no-interaction --no-install
9+
composer create-project symfony/skeleton tmp --prefer-dist --no-progress --no-interaction --no-install
1010

1111
cd tmp
1212
cp -Rp . ..
1313
cd -
1414
rm -Rf tmp/
1515

16-
composer config --no-plugins allow-plugins.williarin/cook true
1716
composer require "php:>=$PHP_VERSION" runtime/frankenphp-symfony
1817
composer config --json extra.symfony.docker 'true'
18+
composer config --no-plugins allow-plugins.williarin/cook true
19+
composer config minimum-stability dev
20+
composer require stochastix/core
21+
composer require --dev symfony/maker-bundle
22+
23+
sed -i '/###> doctrine\/doctrine-bundle ###/,/###< doctrine\/doctrine-bundle ###/d' compose.yaml
24+
sed -i '/###> symfony\/mercure-bundle ###/,/###< symfony\/mercure-bundle ###/d' compose.yaml
25+
sed -i '/###> doctrine\/doctrine-bundle ###/,/###< doctrine\/doctrine-bundle ###/d' compose.override.yaml
26+
sed -i '/###> symfony\/mercure-bundle ###/,/###< symfony\/mercure-bundle ###/d' compose.override.yaml
27+
sed -i '/###> doctrine\/doctrine-bundle ###/,/###< doctrine\/doctrine-bundle ###/d' .env
28+
sed -i '/###> symfony\/mercure-bundle ###/,/###< symfony\/mercure-bundle ###/d' .env
1929

2030
if grep -q ^DATABASE_URL= .env; then
21-
echo 'To finish the installation please press Ctrl+C to stop Docker Compose and run: docker compose up --build --wait'
22-
sleep infinity
31+
exit 0
2332
fi
2433
fi
2534

2635
if [ -z "$(ls -A 'vendor/' 2>/dev/null)" ]; then
2736
composer install --prefer-dist --no-progress --no-interaction
28-
composer require stochastix/core
29-
composer require --dev symfony/maker-bundle
3037
fi
3138

3239
# Display information about the current project
@@ -68,6 +75,7 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
6875
fi
6976
fi
7077

78+
chown -R 1000:1000 .
7179
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
7280
setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var
7381

0 commit comments

Comments
 (0)