Skip to content

Commit 9f2c9d3

Browse files
committed
fix: restore working version
1 parent 26f8484 commit 9f2c9d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+9959
-3474
lines changed

.dockerignore

Lines changed: 0 additions & 34 deletions
This file was deleted.

.editorconfig

Lines changed: 0 additions & 58 deletions
This file was deleted.

.env

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,26 @@
1616

1717
###> symfony/framework-bundle ###
1818
APP_ENV=dev
19-
APP_SECRET=changeme
19+
APP_SECRET=0dfa0f77af1cdd36fe03a59da0722227
2020
###< symfony/framework-bundle ###
21+
22+
###> doctrine/doctrine-bundle ###
23+
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
24+
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
25+
#
26+
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
27+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4"
28+
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
29+
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8"
30+
###< doctrine/doctrine-bundle ###
31+
32+
###> symfony/messenger ###
33+
# Choose one of the transports below
34+
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
35+
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
36+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
37+
###< symfony/messenger ###
38+
39+
###> symfony/mailer ###
40+
# MAILER_DSN=null://null
41+
###< symfony/mailer ###

.env.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

.gitattributes

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy template
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: "30 14 * * *"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
services:
12+
mysql:
13+
image: mysql:8.0
14+
env:
15+
MYSQL_DATABASE: db
16+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
17+
ports:
18+
- 3306:3306
19+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.12"
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install divio-cli
32+
33+
- name: Deploy to Divio
34+
run: |
35+
divio login ${{ secrets.DIVIO_TOKEN }}
36+
divio app deploy test --remote-id ${{ secrets.DIVIO_WEBSITE_ID }} --build-mode FORCE
37+
38+
- name: Test if website is reachable
39+
run: |
40+
curl -v -s --retry 10 --retry-connrefused ${{ secrets.WEBSITE_URL }}
41+
42+
- name: Report error to Sentry
43+
if: failure()
44+
run: |
45+
curl -sL https://sentry.io/get-cli/ | bash
46+
export SENTRY_DSN=${{ secrets.SENTRY_DSN }}
47+
MESSAGE_HEAD='Template: "${{ github.workflow }}" failed in ${{ github.repository }}.'
48+
MESSAGE_BODY='Check <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}> for more details.'
49+
sentry-cli send-event -m "$MESSAGE_HEAD" -m "$MESSAGE_BODY" --log-level=error

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,18 @@
88
/var/
99
/vendor/
1010
###< symfony/framework-bundle ###
11+
12+
###> phpunit/phpunit ###
13+
/phpunit.xml
14+
.phpunit.result.cache
15+
###< phpunit/phpunit ###
16+
17+
###> symfony/phpunit-bridge ###
18+
.phpunit.result.cache
19+
/phpunit.xml
20+
###< symfony/phpunit-bridge ###
21+
22+
###> symfony/asset-mapper ###
23+
/public/assets/
24+
/assets/vendor/
25+
###< symfony/asset-mapper ###

Dockerfile

Lines changed: 14 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,23 @@
1-
#syntax=docker/dockerfile:1.4
1+
FROM php:8.3-fpm
22

3-
# Versions
4-
FROM dunglas/frankenphp:1-alpine AS frankenphp_upstream
5-
6-
# The different stages of this Dockerfile are meant to be built into separate images
7-
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
8-
# https://docs.docker.com/compose/compose-file/#target
9-
10-
11-
# Base FrankenPHP image
12-
FROM frankenphp_upstream AS frankenphp_base
13-
14-
WORKDIR /app
15-
16-
# persistent / runtime deps
17-
# hadolint ignore=DL3018
18-
RUN apk add --no-cache \
19-
acl \
20-
file \
21-
gettext \
22-
git \
23-
;
24-
25-
RUN set -eux; \
26-
install-php-extensions \
27-
@composer \
28-
apcu \
29-
intl \
30-
opcache \
31-
zip \
32-
;
33-
34-
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
353
ENV COMPOSER_ALLOW_SUPERUSER=1
364

37-
###> recipes ###
38-
###< recipes ###
39-
40-
COPY --link frankenphp/conf.d/app.ini $PHP_INI_DIR/conf.d/
41-
COPY --link frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
42-
COPY --link frankenphp/Caddyfile /etc/caddy/Caddyfile
43-
RUN chmod 755 /usr/local/bin/docker-entrypoint
44-
45-
ENTRYPOINT ["docker-entrypoint"]
46-
47-
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
48-
49-
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
50-
51-
# Dev FrankenPHP image
52-
FROM frankenphp_base AS frankenphp_dev
53-
54-
ENV APP_ENV=dev XDEBUG_MODE=off
55-
VOLUME /app/var/
56-
57-
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
58-
59-
RUN set -eux; \
60-
install-php-extensions \
61-
xdebug \
62-
;
63-
64-
COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
65-
66-
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]
67-
68-
# Prod FrankenPHP image
69-
FROM frankenphp_base AS frankenphp_prod
70-
71-
ENV APP_ENV=prod
72-
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
73-
74-
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
75-
76-
COPY --link frankenphp/conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
77-
COPY --link frankenphp/worker.Caddyfile /etc/caddy/worker.Caddyfile
5+
WORKDIR /var/www/html
6+
RUN apt-get update -y && apt-get install -y openssl zip unzip git
7+
RUN docker-php-ext-install mysqli pdo pdo_mysql
788

79-
# prevent the reinstallation of vendors at every changes in the source code
80-
COPY --link composer.* symfony.* ./
81-
RUN set -eux; \
82-
composer install --no-cache --prefer-dist --no-dev --no-autoloader --no-scripts --no-progress
9+
# install composer
10+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
8311

84-
# copy sources
85-
COPY --link . ./
86-
RUN rm -Rf frankenphp/
12+
# install symfony cli
13+
RUN curl -sS https://get.symfony.com/cli/installer | bash
14+
RUN mv /root/.symfony5/bin/symfony /usr/bin/symfony
8715

88-
RUN set -eux; \
89-
mkdir -p var/cache var/log; \
90-
composer dump-autoload --classmap-authoritative --no-dev; \
91-
composer dump-env prod; \
92-
composer run-script --no-dev post-install-cmd; \
93-
chmod +x bin/console; sync;
16+
COPY composer.* /var/www/html/
17+
RUN composer install --no-interaction --no-dev --no-scripts
9418

95-
# Run on Divio Cloud
96-
FROM frankenphp_dev
19+
COPY . /var/www/html
9720

98-
ENV SERVER_NAME=:80
99-
ENV STABILITY=stable
100-
ENV MERCURE_PUBLISHER_JWT_KEY=changeme
101-
ENV MERCURE_SUBSCRIBER_JWT_KEY=changeme
21+
EXPOSE 80
10222

103-
COPY . /app/
23+
CMD ["symfony", "server:start", "--port", "80"]

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Getting Started with Symfony
22

3-
[![Deploy to Divio](https://img.shields.io/badge/DEPLOY-TO%20DIVIO-DFFF67?logo=docker&logoColor=white&labelColor=333333)](https://control.divio.com/app/new/?template_url=https://github.com/divio/getting-started-with-php-symfony/archive/refs/heads/main.zip)
3+
[![Deploy to Divio](https://img.shields.io/badge/DEPLOY-TO%20DIVIO-DFFF67?logo=docker&logoColor=white&labelColor=333333)](https://control.divio.com/app/new/?template_url=https://github.com/divio/getting-started-with-symfony/archive/refs/heads/main.zip)
44

5-
Welcome to our QuickStart template – your portal to swift application development and seamless local testing. Whether you're delving into Symfony for the first time or optimizing your workflow, our template, based on Symfony' [Using Docker](https://symfony.com/doc/current/setup/docker.html) guide, has got you covered.
5+
Welcome to our QuickStart template – your portal to swift application development and seamless local testing. Whether you're delving into Symfony for the first time or optimizing your workflow, our template, based on Symfony' [Guide](https://symfony.com/doc/current/setup.html) guide, has got you covered.
66

77
## Cloud Setup
88

9-
Create a [Divio Account](https://control.divio.com/) and choose **PHP Symfony** from the template selection when creating a new application. Alternatively, click the `Deploy to Divio` button above and follow the app creation wizard. Finally, deploy your app to the `test` or `live` environment.
9+
Create a [Divio Account](https://control.divio.com/) and choose **Symfony** from the template selection when creating a new application. Alternatively, click the `Deploy to Divio` button above and follow the app creation wizard. Finally, deploy your app to the `test` or `live` environment.
1010

1111
For in-depth details about Divio Cloud, refer to the [Divio documentation](https://docs.divio.com/introduction/).
1212

@@ -17,7 +17,7 @@ Install the [Divio CLI](https://github.com/divio/divio-cli) to set up your app l
1717
Alternatively, build this app locally using Docker:
1818

1919
1. Ensure [Docker](https://docs.docker.com/get-docker/) is installed and running.
20-
2. Run `docker compose build --no-cache` to build fresh images.
21-
3. Run `docker compose up --pull always -d` to start the project.
22-
4. Open `http://localhost` in your favorite web browser and [accept the auto-generated TLS certificate](https://stackoverflow.com/a/15076602/1352334).
23-
5. Run `docker compose down --remove-orphans` to stop the Docker containers.
20+
2. Run `docker compose build` to build fresh images.
21+
3. Install dependencies using `docker compose run --rm web composer install`.
22+
4. Run `docker compose up` to start the project.
23+
5. Open `http://localhost:8000`.

assets/app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import './bootstrap.js';
2+
/*
3+
* Welcome to your app's main JavaScript file!
4+
*
5+
* This file will be included onto the page via the importmap() Twig function,
6+
* which should already be in your base.html.twig.
7+
*/
8+
import './styles/app.css';
9+
10+
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');

assets/bootstrap.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { startStimulusApp } from '@symfony/stimulus-bundle';
2+
3+
const app = startStimulusApp();
4+
// register any custom, 3rd party controllers here
5+
// app.register('some_controller_name', SomeImportedController);

assets/controllers.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"controllers": {
3+
"@symfony/ux-turbo": {
4+
"turbo-core": {
5+
"enabled": true,
6+
"fetch": "eager"
7+
},
8+
"mercure-turbo-stream": {
9+
"enabled": false,
10+
"fetch": "eager"
11+
}
12+
}
13+
},
14+
"entrypoints": []
15+
}

0 commit comments

Comments
 (0)