You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributing/setup-your-environment.md
+63-16Lines changed: 63 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,21 @@ description: >-
4
4
contribute to Speedtest Tracker.
5
5
---
6
6
7
-
# Setup Your Environment
7
+
# Development Environment
8
8
9
-
Speedtest Tracker is built on the [Laravel](https://laravel.com/) framework, this means we get to use some awesome 1st party packages like [Laravel Sail](https://laravel.com/docs/9.x/sail) to create a local containerized development environment.
9
+
Speedtest Tracker is built on the [Laravel](https://laravel.com/) framework, this means we get to use some awesome 1st party packages like [Laravel Sail](https://laravel.com/docs/10.x/sail) to create a local containerized development environment.
10
10
11
11
These directions will walk you through the steps of setting up that environment.
12
12
13
13
{% hint style="info" %}
14
14
These directions assume you have a working knowledge of the Laravel framework. If you have questions on how to use it the [Laravel Docs](https://laravel.com/docs/9.x) and [Laracasts series](https://laracasts.com/series/laravel-8-from-scratch) on "Laravel from Scratch" are a good place to start.
15
15
{% endhint %}
16
16
17
-
### 1. Clone the repository
17
+
***
18
+
19
+
### Setup and Start the Development Environment
20
+
21
+
#### 1. Clone the repository
18
22
19
23
First let's clone the [repository](https://github.com/alexjustesen/speedtest-tracker) to your machine, I prefer [GitHub's CLI](https://cli.github.com/) so that command is included below.
### 2. Make a copy of \`.env.example\` and update DB variables
30
+
####2. Make a copy of \`.env.example\` and update DB variables
27
31
28
32
Next we need to make a copy of `.env.example`, the environment file is what Laravel uses.
29
33
30
34
```bash
31
35
cp .env.example .env
32
36
```
33
37
34
-
You'll also want to fill in a few `DB_` variables here as well which will control which database Laravel will use. I've included PostgreSQL as the default database system.
38
+
You'll also want to fill in a few `DB_` variables here as well which will control which database Laravel will use. I've included MySQL as the default database for the development environment.
35
39
36
40
```
37
-
DB_CONNECTION=pgsql
38
-
DB_HOST=pgsql
39
-
DB_PORT=5432
41
+
DB_CONNECTION=mysql
42
+
DB_HOST=mysql
43
+
DB_PORT=3306
40
44
DB_DATABASE=speedtest_tracker
41
45
DB_USERNAME=sail
42
46
DB_PASSWORD=password
43
47
```
44
48
45
-
### 3. Install Composer dependencies
49
+
####3. Install Composer dependencies
46
50
47
51
We'll use a temporary container to install the Composer dependencies for the application.
48
52
49
53
```bash
50
54
docker run --rm \
51
55
-u "$(id -u):$(id -g)" \
52
-
-v $(pwd):/var/www/html \
56
+
-v "$(pwd):/var/www/html" \
53
57
-w /var/www/html \
54
-
laravelsail/php81-composer:latest \
58
+
laravelsail/php82-composer:latest \
55
59
composer install --ignore-platform-reqs
56
60
```
57
61
58
-
### 4. Starting a development environment
62
+
####4. Build Sail development container
59
63
60
-
To start up the environment we can now use the Sail binary that is included with the package to build our development image and spin up a network with a database container.
64
+
We utilize [Laravel Sail](https://laravel.com/docs/10.x/sail) for a local development environment this way on your machine the only requirements are Git and Docker. To build the development environment run the commands below.
65
+
66
+
```bash
67
+
./vendor/bin/sail build --no-cache
68
+
69
+
# or if you have a Sail alias setup...
70
+
sail build --no-cache
71
+
```
72
+
73
+
#### 5. Start the development environment
74
+
75
+
To start up the environment we can now use the Sail binary that is included with the package to start our development environment.
61
76
62
77
```bash
63
78
./vendor/bin/sail up -d
64
79
65
-
# or if you have a Sail alias setup..
80
+
# or if you have a Sail alias setup...
66
81
sail up -d
67
82
```
68
83
69
-
### 5. Stopping the development environment
84
+
#### 6. Installing the application
85
+
86
+
Once the environment is setup you can install a fresh version of the application by running the following command. Keep in mind this WILL refresh the entire database.
87
+
88
+
```bash
89
+
./vendor/bin/sail artisan app:install --force
90
+
91
+
# or if you have a Sail alias setup...
92
+
sail artisan app:install --force
93
+
```
94
+
95
+
{% hint style="info" %}
96
+
You can reset your development environment at any time by running the `app:install` command.
97
+
{% endhint %}
98
+
99
+
***
100
+
101
+
### Processing Jobs in the Queue using a Worker
102
+
103
+
Processes like running a speedtest and sending notifications are offloaded to be run by a worker process. If you're testing or developing anything requiring the queue jobs be processed run the command below.
104
+
105
+
```bash
106
+
./vendor/bin/sail artisan queue:work
107
+
108
+
# or if you have a Sail alias setup...
109
+
sail artisan queue:work
110
+
```
111
+
112
+
***
113
+
114
+
### Stopping the development environment
115
+
116
+
When you're done in the environment you can stop the containers using the command below.
0 commit comments