Skip to content

Commit e1f7b3d

Browse files
author
Julien Neuhart
committed
Update README with a better installation process for Vagrant users
1 parent 167e27f commit e1f7b3d

File tree

1 file changed

+40
-22
lines changed

1 file changed

+40
-22
lines changed

README.md

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,7 @@ On Linux and macOS, run `sudo nano /etc/hosts` to edit it.
6262

6363
On Windows, edit the file `C:\Windows\System32\drivers\etc\hosts` with administrative privileges.
6464

65-
### Vagrant
66-
67-
Check there is no application running on port 80 (like Apache or another virtual machine).
68-
69-
If OK, run `make vagrant`, then `vagrant up`, and finally `vagrant ssh` to connect to the virtual machine.
70-
From here, you'll be able to run all the next commands like Linux users!
71-
72-
> Update the variable `VAGRANT_PROJECT_NAME` from the [Makefile](Makefile) with your project name.
73-
> Only use alphanumeric characters (no spaces, distinguish words with `_` or `-`).
74-
75-
### Starting the Docker Compose stack
65+
### First start
7666

7767
Copy the file [.env.dist](.env.dist) to a file named `.env`. For instance:
7868

@@ -83,12 +73,44 @@ cp .env.dist .env
8373
> Edit the [.env.dist](.env.dist) by updating the default values of `DOMAIN`, `MYSQL_DATABASE` and `APP_SECRET`
8474
> environment variables.
8575
86-
Next, make sure there is no application running on port 80 (Vagrant users can skip this check).
76+
---
77+
78+
#### Vagrant user
79+
80+
"Comment" the `STARTUP_COMMAND_3` and `STARTUP_COMMAND_4` environment variables from the `api` service
81+
in the [docker-compose.yml](docker-compose.yml) file.
82+
83+
Next, run:
84+
85+
```
86+
docker-compose up webapp api
87+
```
88+
89+
📣  This command start the `webapp` and `api` service. While booting, these services install the JavaScript
90+
and PHP dependencies. We cannot do that directly in the Vagrant VM as `yarn` and `composer install` fail miserably the
91+
first time.
8792

88-
**📣  Vagrant users: the first time you start the Docker Compose stack, you have to "comment" the following
89-
environment variables from the `api` service in the [docker-compose.yml](docker-compose.yml) file:
90-
`STARTUP_COMMANDS_2`, `STARTUP_COMMAND_3`, and `STARTUP_COMMAND_4`. Indeed, `composer install` fails miserably,
91-
but there is a workaround. See below.**
93+
Once the services have installed the dependencies, you may stop them with:
94+
95+
```
96+
CTRL+C
97+
docker-compose down
98+
```
99+
100+
Don't forget to uncomment the previous environments variables from the `api` service
101+
in the [docker-compose.yml](docker-compose.yml) file.
102+
103+
Next, check there is no application running on port 80 (like Apache or another virtual machine).
104+
105+
If OK, run `make vagrant`, then `vagrant up`, and finally `vagrant ssh` to connect to the virtual machine.
106+
From here, you'll be able to run all the next commands like Linux users!
107+
108+
> Update the variable `VAGRANT_PROJECT_NAME` from the [Makefile](Makefile) with your project name.
109+
> Only use alphanumeric characters (no spaces, distinguish words with `_` or `-`).
110+
111+
---
112+
113+
Next, make sure there is no application running on port 80 (Vagrant users can skip this check).
92114

93115
Good? You may now start all the Docker containers with the following commands:
94116

@@ -99,15 +121,11 @@ make up
99121
It may take some time as each container will also set up itself, such as installing dependencies (PHP, JavaScript, etc.),
100122
compiling sources (JavaScript), or running migrations to set up the database structure.
101123

102-
**📣  In some cases, the `api` service will try to run the migrations before the `mysql` service is ready. If so, restart
103-
the `api` service with `docker-compose up -d api`.**
124+
**📣  In some cases, the `api` service will try to run the migrations before the `mysql` service is ready.
125+
If so, restart the `api` service with `docker-compose up -d api`.**
104126

105127
The containers will be ready faster next time you run this command as the first run is doing most of the setup.
106128

107-
**📣  Vagrant users: enter the `api` service with `make api`. Here, run `composer install --prefer-source`
108-
(and prepare some coffee). When done, exit the container, uncomment the previous environments variables,
109-
and rerun `make up`.**
110-
111129
Once everything is ready, the following endpoints should be available:
112130

113131
* http://traefik.companies-and-products.localhost (Reverse proxy, the entry point of all the HTTP requests)

0 commit comments

Comments
 (0)