Skip to content

Commit f2b8623

Browse files
author
Julien Neuhart
committed
WIP: website
1 parent 852f2ef commit f2b8623

Some content is hidden

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

54 files changed

+10238
-191
lines changed

Diff for: README.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
**Caution:** this is still work in progress.
1+
This is a template of a *README*.
2+
3+
Official documentation: https://thecodingmachine.github.io/symfony-boilerplate
24

35
---
46

@@ -22,7 +24,7 @@ Install the latest version of [Docker](https://docs.docker.com/install/) and
2224
We strongly recommend installing [Vagrant](https://www.vagrantup.com/) and
2325
[VirtualBox](https://www.virtualbox.org/).
2426

25-
Indeed, Docker currently has huge performance issues on macOS, and using Vagrant allows us to have an almost
27+
Indeed, Docker currently has substantial performance issues on macOS, and using Vagrant allows us to have an almost
2628
Linux-like experience regarding performances.
2729

2830
#### Windows
@@ -50,7 +52,7 @@ If you're using Vagrant, check there is no application running on port 80 (like
5052
If OK, run `make vagrant`, then `vagrant up`, and finally `vagrant ssh` to connect to the virtual machine.
5153
From here, you'll be able to run all the next commands like Linux users!
5254

53-
> Update the variable `PROJECT_NAME` from the [Makefile](Makefile) with your project name.
55+
> Update the variable `VAGRANT_PROJECT_NAME` from the [Makefile](Makefile) with your project name.
5456
> Only use alphanumeric characters (no spaces, distinguish words with `_` or `-`).
5557
5658
### Starting the Docker Compose stack
@@ -161,20 +163,13 @@ Make sure you have read the following documentations:
161163
**Day-to-day guidelines**
162164

163165
* [Web application guidelines](src/webapp/README.md)
164-
* [API guidelines](src/api/README.md)
166+
* [API guidelines](src/api/README.md)``
165167

166168
**In-depth explanations**
167169

168-
* [Configuration - development environment, API, web application](docs/configuration.md)
169-
* [Security](docs/security.md)
170-
* [Internationalization (i18n)](docs/i18n.md)
171-
* [Emails](docs/emails.md)
172-
* [Forms validation](docs/forms_validation.md)
173-
* [Lists](docs/lists.md)
174-
* [Resources - assets, temporary files, uploaded files](docs/resources.md)
175-
* [Housekeeping - or how to keep everything up-to-date](docs/housekeeping.md)
170+
* https://thecodingmachine.github.io/symfony-boilerplate/docs/VERSION
176171

177-
> Don't hesitate to update these documentations but also add your documentations.
172+
> Update the previous link with the version of the boilerplate in use.
178173
179174
### How to stop the stack?
180175

Diff for: docs/.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

Diff for: docs/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```console
8+
yarn install
9+
```
10+
11+
## Local Development
12+
13+
```console
14+
yarn start
15+
```
16+
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```console
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
```console
30+
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31+
```
32+
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

Diff for: docs/babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

Diff for: docs/docs/1_Get Started/1_1_Overview.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Overview
3+
slug: /
4+
---
5+
6+
The Symfony Boilerplate provides a dummy application with core concepts and functionalities to help you build
7+
a modern web application.
8+
9+
Many services compose this boilerplate.
10+
11+
## Application layer
12+
13+
This layer has two services:
14+
15+
1. The GraphQL API, built with Symfony 5 and [GraphQLite](https://graphqlite.thecodingmachine.io/).
16+
2. The Web Application, built with Nuxt.js.
17+
18+
## Data layer
19+
20+
This layer has 3 services:
21+
22+
1. MySQL for hosting session and business data.
23+
2. Redis for asynchronous tasks (e.g., emails).
24+
3. [MinIO](https://min.io/) for storing files (e.g., uploads).
25+
26+
:::note
27+
28+
In production, you may externalize them to the equivalent services from your provider.
29+
30+
:::
31+
32+
## Additional services
33+
34+
These services are mostly useful in development:
35+
36+
1. [Traefik](https://doc.traefik.io/traefik/), a reverse proxy.
37+
2. [MailHog](https://github.com/mailhog/MailHog), an email trapper with a web UI.
38+
3. phpMyAdmin, a web UI for displaying your database's data.

Diff for: docs/docs/1_Get Started/1_2_Installation.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Installation
3+
slug: /installation
4+
---
5+
6+
Create your Git repository on the platform of your choice, then add a new remote to it:
7+
8+
```bash title="console"
9+
git remote add boilerplate https://github.com/thecodingmachine/symfony-boilerplate.git
10+
```
11+
12+
Finally, pull the source code from a [release](https://github.com/thecodingmachine/symfony-boilerplate/tags) to
13+
your current branch:
14+
15+
```bash script title="console"
16+
git pull boilerplate [TAG]
17+
```
18+
19+
You may now follow the instructions of the *README*! 😋
20+
21+
:::note
22+
23+
There are comments on the *README* to help you customize its content.
24+
25+
:::
26+
27+
28+
29+
30+
+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
title: Docker Compose
3+
slug: /development-environment/docker-compose
4+
---
5+
6+
[Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose/) are the core technologies that orchestrate the
7+
services of the boilerplate.
8+
9+
They will help you set up a complete development environment close to your target production infrastructure.
10+
11+
## Usage
12+
13+
* 🚀 `make up`: starts the Docker Compose stack.
14+
* 💣 `make down`: stops the Docker Compose stack.
15+
* 📢 `docker-compose logs -f`: displays the logs of **all** your services.
16+
* 📢 `docker-compose logs -f [SERVICE_NAME]` displays the logs of one service.
17+
18+
## Configuration
19+
20+
Your development environment mostly consists of two files:
21+
22+
* *docker-compose.yml*
23+
* *.env* file (and its template *.env.dist*)
24+
25+
The *docker-compose.yml* file lists all the services of the boilerplate and their configuration.
26+
The services use mostly environment variables to configure themselves.
27+
Most of the time, you will set their values directly in the *docker-compose.yml* file.
28+
29+
However, you don't want to commit your secrets to your Git repository. Also, you may want to reuse some values across
30+
different services.
31+
32+
Docker Compose provides an easy way for such scenarios; it can read the values from the *.env* file.
33+
34+
For instance:
35+
36+
```.env title=".env"
37+
FOO=hello
38+
```
39+
40+
```yaml title="docker-compose.yml"
41+
service_foo:
42+
environment:
43+
FOO: "$FOO"
44+
```
45+
46+
Becomes at runtime (e.g., when running a Docker Compose command):
47+
48+
```yaml
49+
service_foo:
50+
environment:
51+
FOO: "hello"
52+
```
53+
54+
:::note
55+
56+
When adding a new variable in the *.env* file, don't forget to update the template *.env.dist* with it.
57+
It will help other developers to notice this change and update their *.env* files accordingly.
58+
59+
You should never commit the *.env* file as it may contain secrets; always use dummy values for your secrets
60+
in the *.env.dist* template.
61+
62+
:::
63+
64+
## Add a new service
65+
66+
The existing services might not be enough for your use cases.
67+
You may therefore add new services to your *docker-compose.yml* file.
68+
69+
### Application layer
70+
71+
```yaml title="docker-compose.yml"
72+
services:
73+
74+
your_service_name:
75+
image: an_image:a_tag
76+
labels:
77+
- traefik.enable=true
78+
- traefik.http.routers.your_service_name_router.rule=Host(`your_service_subdomain.$DOMAIN`)
79+
- traefik.http.routers.your_service_name_router.service=your_service_name_service
80+
# If your service runs on another port than 80.
81+
# - traefik.http.services.your_service_name_service.loadbalancer.server.port=3000
82+
environment:
83+
FOO: "BAR"
84+
volumes:
85+
- src/your_service_source_code_folder:/path/in/the/docker/container
86+
```
87+
88+
:::note
89+
90+
Always add a service code source in the *src* folder.
91+
92+
:::
93+
94+
### Data layer
95+
96+
```yaml title="docker-compose.yml"
97+
services:
98+
99+
your_service_name:
100+
image: an_image:a_tag
101+
environment:
102+
FOO: "BAR"
103+
volumes:
104+
- your_service_name_data:/path/in/the/docker/container
105+
106+
volumes:
107+
108+
your_service_name_data:
109+
driver: local
110+
```
111+
112+
## Extend a Docker image
113+
114+
You might need to extend a Docker image for installing one or more packages.
115+
116+
For instance, let's say you want to install the `pdftk` package for the API:
117+
118+
```dockerfile title="src/api/Dockerfile"
119+
FROM thecodingmachine/php:7.4-v3-apache AS extended
120+
121+
# Always use the root user for installing packages.
122+
USER root
123+
124+
# Install PDFtk.
125+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends pdftk &&\
126+
# Print versions of PDFtk.
127+
pdftk --version
128+
129+
# Go back to the default Docker image user.
130+
USER docker
131+
132+
FROM extended
133+
# Your production Docker image instructions.
134+
```
135+
136+
```yaml title="docker-compose.yml"
137+
api:
138+
#image: thecodingmachine/php:7.4-v3-apache
139+
build:
140+
context: "./src/api"
141+
target: "extended"
142+
```
143+
144+
```makefile title="Makefile"
145+
# Start the Docker Compose stack.
146+
up:
147+
docker-compose up --build -d
148+
```

Diff for: docs/docs/2_Development Environment/2_2_Vagrant.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Vagrant
3+
slug: /development-environment/vagrant
4+
---
5+
6+
On macOS and Windows, Docker currently has substantial performance issues.
7+
8+
[Vagrant](https://www.vagrantup.com/) will help you to have an almost Linux-like experience regarding performances.
9+
10+
## Usage
11+
12+
* 📦 `make vagrant`: creates the *Vagrantfile*.
13+
* 🚀 `vagrant up`: installs and starts the virtual machine.
14+
* 🚇 `vagrant ssh`: connects to the virtual machine.
15+
* 🚦 `vagrant halt`: stops the virtual machine.
16+
* 💣 `vagrant destroy`: destroys the virtual machine.
17+
18+
## Configuration
19+
20+
Vagrant's configuration consists of three files:
21+
22+
* *Makefile*
23+
* *scripts/create-vagrantfile-from-template.sh*
24+
* *Vagrantfile* (and its template *Vagrantfile.template*)
25+
26+
The *Makefile* contains the variables `VAGRANT_BOX`, `VAGRANT_PROJECT_NAME`, `VAGRANT_MEMORY`, `VAGRANT_CPUS`,
27+
and `VAGRANT_DOCKER_COMPOSE_VERSION`.
28+
29+
The command `make vagrant` reads these variables and uses them as arguments
30+
when calling the *create-vagrantfile-from-template.sh* script.
31+
32+
The later replaces placeholders from the *Vagrantfile.template* by the variables' values and creates a new *Vagrantfile*.
33+
34+
:::note
35+
36+
You should never commit the *Vagrantfile*.
37+
38+
:::

0 commit comments

Comments
 (0)