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: docs/developers/environment.md
+43-43
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ id: environment
3
3
title: Environment Configuration
4
4
---
5
5
6
-
# Development Configuration
6
+
# Environment Configuration
7
7
8
8
This is for running a local configuration, for running unit-tests, etc.
9
9
@@ -13,86 +13,85 @@ This is just how I work on phpVMS, to quickly reset the database and test/develo
13
13
If you're on Windows, I highly recommend installing WSL with your distro of choice (I use Ubuntu). If you don't have `make` available, open the `Makefile` and look for the commands to run for the individual commands of what you're trying to run.
14
14
:::
15
15
16
-
### Creating and Resetting the Environment
16
+
:::info
17
+
You may want to disable caching during development phases to ensure your changes are applied correctly, as caching cna prevent changes from taking effect.
18
+
To do this, set `CACHE_DRIVER=null` in your `.env` file.
19
+
20
+
:::
17
21
18
-
:::caution
19
-
This requires sqlite to be installed on your system
22
+
:::info
23
+
We strongly recommend reading the [Laravel Documentation](https://laravel.com/docs/10.x), as it's more detailed and up-to-date. Since phpVMS is based on Laravel, the installation process is the same.
24
+
In addition, you can simply use the `php artisan phpvms:dev-install` command to set up a development database.
20
25
:::
21
26
22
-
To quickly setup a running install, you can do this:
27
+
## Creating and Resetting the Environment with docker
28
+
29
+
We are using [Laravel Sail](https://laravel.com/docs/10.x/sail#main-content) which provides a simple way to set up and manage a local development environment for laravel apps using Docker.
30
+
31
+
Before you begin, ensure you have docker installed on your system
The `phpvms:dev-install` command creates the two config files: `config.php` and `.env`. It will then run the migrations, and install the sample seed data, which is located in `app/Database/seeds/sample.yml`
47
+
The `phpvms:dev-install` command creates the `.env` config file. It will then run the migrations, and install the sample seed data, which is located in `app/Database/seeds/sample.yml`
32
48
33
49
Then to reset the database and reinstall the dev data:
This does require sqlite. If you want to use MySQL, you need to run the phpVMS installer, so it can generate the config files for MySQL (or you can modify the generated `config.php`), then you can run the above command to reset the database and migrations in MySQL.
55
+
This does require sqlite. If you want to use MySQL, you need to run the phpVMS installer, so it can generate the config files for MySQL (or you can modify the generated `.env`), then you can run the above command to reset the database and migrations in MySQL.
40
56
41
-
####Resetting the Environment
57
+
### Resetting the Environment
42
58
43
59
To reset the database/clear cache, use this command.
44
60
45
61
```bash
46
-
make reload-db
62
+
./vendor/bin/sail artisan database:create --reset
63
+
./vendor/bin/sail artisan migrate --seed
47
64
```
48
65
49
66
You can run the `reload-db` command as much as you want. If you log in using the default login ([email protected]), this won't log you out, it'll just reload the database with all the sample data (from app/Database/seeds/sample.yml)
50
67
51
-
---
52
-
53
-
## Updating
68
+
### Updating
54
69
55
-
extract files and run the migrations:
70
+
Extract files and run the migrations:
56
71
57
72
```bash
58
-
php artisan migrate
73
+
git pull origin dev
74
+
./vendor/bin/sail artisan migrate
59
75
```
60
-
61
76
---
77
+
## Without Docker
62
78
63
-
## Composer Access
79
+
If you don't want to use Docker, you can use other software like [Laravel Herd](https://herd.laravel.com) (Mac/Windows) or [Laragon](https://laragon.org/) (Windows only).
64
80
65
-
By default, the Makefile calls the system-wide `composer`. If your host requires a certain path or name for composer, add `COMPOSER=` to the front of the `make` command, e.g:
81
+
There are many tutorials on how to install Laravel applications with these softwares, but here are the basics:
66
82
67
83
```bash
68
-
COMPOSER=composer.phar make install
69
-
```
70
-
71
-
---
72
-
73
-
# Docker Compose
74
-
75
-
A full development environment can be brought up using Docker, without having to install composer/npm locally
76
-
77
-
```bash
78
-
make docker-test
79
-
80
-
# **OR** with docker-compose directly
81
-
82
-
docker-compose -f docker-compose.yml -f docker-compose.local.yml up
83
-
```
84
-
85
-
Then go to `http://localhost`. If you're using dnsmasq, the `app` container is listening on `phpvms.test`, or you can add to your `/etc/hosts` file:
Then visit your site at `http://phpvms.test`. This is what I (Nabeel) use for my day-to-day development
91
+
This does require sqlite. If you want to use MySQL, you need to run the phpVMS installer, so it can generate the config files for MySQL (or you can modify the generated `.env`), then you can run the above command to reset the database and migrations in MySQL.
92
92
93
93
---
94
-
95
-
# Laravel Valet
94
+
## Laravel Valet
96
95
97
96
If you don't want to use `docker-compose`, easiest way to load locally is to install [Laravel Valet](https://laravel.com/docs/5.5/valet) (if you're running a Mac). Follow the instructions to install; you install it, go to your phpvms directory, and run:
98
97
@@ -105,3 +104,4 @@ Now going to `http://phpvms.test` should work. If you want to use mysql, follow
105
104
The default username and password are `[email protected]` and `admin`. To see the available users in the development environment, [see this file](https://github.com/nabeelio/phpvms/blob/master/app/Database/seeds/sample.yml#L11)
106
105
107
106
There is no reason you can't use [MAMP](https://www.mamp.info/en) or [XAMPP](https://www.apachefriends.org), or if you're feeling fancy, using Docker or configuring any webservers yourself.
0 commit comments