Skip to content

Commit 54f014f

Browse files
authored
Merge pull request #44 from thecodingmachine/upgrade-php8.0
Upgrade to php8.0
2 parents 3902739 + 434844e commit 54f014f

File tree

92 files changed

+5199
-4241
lines changed

Some content is hidden

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

92 files changed

+5199
-4241
lines changed

.env.dist

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ VAGRANT_DOCKER_COMPOSE_VERSION=1.28.2
1010
# Consider putting here your secrets with dummy values and variables you want to
1111
# reuse in two or more services.
1212

13-
APP_NAME=Symfony Boilerplate
13+
APP_NAME="Symfony Boilerplate"
1414

1515
# Domain
1616
DOMAIN=symfony-boilerplate.localhost
@@ -36,4 +36,7 @@ STORAGE_ACCESS_KEY=accesskey
3636
STORAGE_SECRET_KEY=secretkey
3737

3838
# i18n
39-
DEFAULT_LOCALE=en
39+
DEFAULT_LOCALE=en
40+
41+
# XDebug
42+
XDEBUG_MODE=debug,coverage

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Vagrantfile
2-
.env
1+
/Vagrantfile
2+
/.env

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Environment Definitions
22

33
.api: &api
4-
image: thecodingmachine/php:7.4-v4-cli
4+
image: thecodingmachine/php:8.0-v4-cli
55
variables:
66
PHP_EXTENSIONS: gd pdo_mysql xdebug imap intl
77
PHP_INI_MEMORY_LIMIT: 1G

Makefile

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,65 @@ include .env
22

33
.PHONY: up down webapp api consume vagrant
44

5-
# Start the Docker Compose stack.
6-
up:
5+
.env: ## Setup .env from dist
6+
cp .env.dist .env
7+
8+
up: .env ## Start the Docker Compose stack.
79
docker-compose up -d
810

9-
# Stop the Docker Compose stack.
10-
down:
11+
12+
down: ## Stop the Docker Compose stack.
1113
docker-compose down
1214

13-
# Run bash in the webapp service.
14-
webapp:
15+
webapp: ## Run bash in the webapp service.
1516
docker-compose exec webapp bash
1617

17-
# Run bash in the api service.
18-
api:
18+
api: ## Run bash in the api service.
1919
docker-compose exec api bash
2020

21-
# Consume messages from the queue.
22-
consume:
21+
consume: ## Consume messages from the queue.
2322
docker-compose exec api php bin/console messenger:consume async -vv
2423

25-
# Create the Vagrantfile from the template Vagrantfile.template.
26-
vagrant:
24+
vagrant: ## Create the Vagrantfile from the template Vagrantfile.template.
2725
./scripts/create-vagrantfile-from-template.sh \
2826
$(VAGRANT_BOX) \
2927
$(VAGRANT_PROJECT_NAME) \
3028
$(VAGRANT_MEMORY) \
3129
$(VAGRANT_CPUS) \
3230
$(VAGRANT_DOCKER_COMPOSE_VERSION)
31+
32+
.PHONY: create-migrate
33+
create-migrate: ## Create a new migration file
34+
docker-compose exec api bin/console doctrine:database:drop --force
35+
docker-compose exec api bin/console doctrine:database:create -n
36+
docker-compose exec api bin/console doctrine:migrations:migrate -n
37+
docker-compose exec api bin/console make:migration
38+
docker-compose exec api bin/console doctrine:migrations:migrate -n
39+
40+
.PHONY: graphql-print-schema
41+
graphql-print-schema: ## Display current GraphQL Schema
42+
docker-compose exec api ./bin/console graphqlite:dump-schema
43+
44+
.PHONY: test-% lint-%
45+
test-api: ## Launch test in api
46+
docker-compose exec api composer yaml-lint
47+
docker-compose exec api composer cscheck
48+
docker-compose exec api composer phpstan
49+
docker-compose exec api composer pest
50+
docker-compose exec api composer deptrac
51+
52+
test-webapp: ## Launch test in webapp
53+
docker-compose exec webapp yarn lint
54+
55+
lint-api: ## Launch linter in api
56+
docker-compose exec api composer yaml-lint
57+
docker-compose exec api composer csfix
58+
docker-compose exec api composer cscheck
59+
60+
lint-webapp: ## Launch linter in webapp
61+
docker-compose exec webapp yarn lint:fix
62+
docker-compose exec webapp yarn lint
63+
64+
.PHONY: help
65+
help: ## This help.
66+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This is a template of a *README*. Adapt it according to the comments and your ne
1414

1515
> Replace this title and the following description with your project name and description.
1616
17-
A web application built with Nuxt.js, Symfony 5, and GraphQL.
17+
A web application built with Nuxt.js 2, Symfony 5.4 (LTS), and GraphQL 5.
1818

1919
## Setup
2020

docker-compose.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ services:
1919
- "80:80"
2020
volumes:
2121
- /var/run/docker.sock:/var/run/docker.sock
22+
networks:
23+
default:
24+
aliases:
25+
# Required so that the web application is able to call the same endpoint
26+
# from both the browser and the server.
27+
- "$API_SUBDOMAIN.$DOMAIN"
2228

2329
webapp:
2430
image: thecodingmachine/nodejs:14
@@ -63,7 +69,7 @@ services:
6369
- ./src/webapp:/usr/src/app
6470

6571
api:
66-
image: thecodingmachine/php:7.4-v4-apache
72+
image: thecodingmachine/php:8.0-v4-apache
6773
labels:
6874
- traefik.enable=true
6975
- traefik.http.routers.api_router.rule=Host(`${API_SUBDOMAIN}.${DOMAIN}`)
@@ -76,10 +82,9 @@ services:
7682
PHP_EXTENSION_INTL: "1"
7783
PHP_EXTENSION_GD: "1"
7884
PHP_INI_MEMORY_LIMIT: "1G"
79-
STARTUP_COMMAND_1: "touch .env" # Create a fake .env file so that Symfony does not complain on startup.
80-
STARTUP_COMMAND_2: "composer install"
81-
STARTUP_COMMAND_3: "php bin/console doctrine:migrations:migrate -n --allow-no-migration" #FIXME: if no flag --allow-no-migration, the command fails. Why?
82-
STARTUP_COMMAND_4: "php bin/console app:init-storage:s3"
85+
STARTUP_COMMAND_1: "composer install"
86+
STARTUP_COMMAND_2: "php bin/console doctrine:migrations:migrate -n --allow-no-migration" #FIXME: if no flag --allow-no-migration, the command fails. Why?
87+
STARTUP_COMMAND_3: "php bin/console app:init-storage:s3"
8388
# Symfony.
8489
# ---------------------
8590
APP_NAME: "${APP_NAME}"
@@ -117,14 +122,12 @@ services:
117122
MAIL_FROM_NAME: "$APP_NAME"
118123
MAIL_WEBAPP_URL: "http://${DOMAIN}/"
119124
MAIL_WEBAPP_UPDATE_PASSWORD_ROUTE_FORMAT: "%s/update-password/%s/%s" # {locale}/update-password/{resetPasswordTokenId}/{plainToken}
125+
# Debug
126+
XDEBUG_MODE: ${XDEBUG_MODE:-debug}
120127
volumes:
121128
- ./src/api:/var/www/html
122-
networks:
123-
default:
124-
aliases:
125-
# Required so that the web application is able to call the same endpoint
126-
# from both the browser and the server.
127-
- "${API_SUBDOMAIN}.${DOMAIN}"
129+
depends_on:
130+
- mysql
128131

129132
# For business data and user sessions.
130133
mysql:
@@ -151,7 +154,7 @@ services:
151154
- /var/lib/mysql
152155

153156
phpmyadmin:
154-
image: phpmyadmin/phpmyadmin:5.0
157+
image: phpmyadmin/phpmyadmin:5
155158
labels:
156159
- traefik.enable=true
157160
- traefik.http.routers.phpmyadmin_router.rule=Host(`phpmyadmin.$DOMAIN`)

docs/docs/02_Development Environment/1_Docker Compose.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ You might need to extend a Docker image for installing one or more packages.
122122
For instance, let's say you want to install the `pdftk` package for the API:
123123

124124
```dockerfile title="src/api/Dockerfile"
125-
FROM thecodingmachine/php:7.4-v4-apache AS extended
125+
FROM thecodingmachine/php:8.0-v4-apache AS extended
126126
127127
# Always use the root user for installing packages.
128128
USER root
@@ -141,7 +141,7 @@ FROM extended
141141

142142
```yaml title="docker-compose.yml"
143143
api:
144-
#image: thecodingmachine/php:7.4-v4-apache
144+
#image: thecodingmachine/php:8.0-v4-apache
145145
build:
146146
context: "./src/api"
147147
target: "extended"

docs/docs/17_CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ title: CHANGELOG
33
slug: /changelog
44
---
55

6+
## 0.3.0
7+
8+
* Upgrade Symfony from `5.2` to `5.4` (LTS version)
9+
* Upgrade php from `7.4` to `8.0`
10+
* Upgrade GraphQLite to `v5`
11+
* Add some useful command in `Makefile` (test and lint)
12+
* Add a test case to verify validity of the graphQL schema
13+
614
## 0.2.0
715

816
### API

src/api/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Keep empty to load values from docker-compose environment

src/api/.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

0 commit comments

Comments
 (0)