Skip to content

Commit 2474cd4

Browse files
authored
Update Developers Docs (#22)
* Update Developers Docs * Update laravel docs links
1 parent 979e84b commit 2474cd4

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

docs/developers/environment.md

+43-43
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: environment
33
title: Environment Configuration
44
---
55

6-
# Development Configuration
6+
# Environment Configuration
77

88
This is for running a local configuration, for running unit-tests, etc.
99

@@ -13,86 +13,85 @@ This is just how I work on phpVMS, to quickly reset the database and test/develo
1313
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.
1414
:::
1515

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+
:::
1721

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.
2025
:::
2126

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
2332

2433
```bash
2534
git clone https://github.com/nabeelio/phpvms.git phpvms
2635
cd phpvms
27-
composer update
28-
php artisan phpvms:dev-install
36+
docker run --rm \
37+
-u "$(id -u):$(id -g)" \
38+
-v "$(pwd):/var/www/html" \
39+
-w /var/www/html \
40+
laravelsail/php83-composer:latest \
41+
composer install --ignore-platform-reqs
42+
43+
./vendor/bin/sail up -d
44+
./vendor/bin/sail artisan phpvms:dev-install
2945
```
3046

31-
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`
3248

3349
Then to reset the database and reinstall the dev data:
3450

3551
```bash
36-
php artisan phpvms:dev-install --reset-db
52+
./vendor/bin/sail artisan phpvms:dev-install --reset-db
3753
```
3854

39-
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.
4056

41-
#### Resetting the Environment
57+
### Resetting the Environment
4258

4359
To reset the database/clear cache, use this command.
4460

4561
```bash
46-
make reload-db
62+
./vendor/bin/sail artisan database:create --reset
63+
./vendor/bin/sail artisan migrate --seed
4764
```
4865

4966
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)
5067

51-
---
52-
53-
## Updating
68+
### Updating
5469

55-
extract files and run the migrations:
70+
Extract files and run the migrations:
5671

5772
```bash
58-
php artisan migrate
73+
git pull origin dev
74+
./vendor/bin/sail artisan migrate
5975
```
60-
6176
---
77+
## Without Docker
6278

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).
6480

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:
6682

6783
```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:
84+
git clone https://github.com/nabeelio/phpvms.git phpvms
85+
cd phpvms
8686

87-
```
88-
127.0.0.1 phpvms.test
87+
composer install
88+
php artisan phpvms:dev-install
8989
```
9090

91-
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.
9292

9393
---
94-
95-
# Laravel Valet
94+
## Laravel Valet
9695

9796
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:
9897

@@ -105,3 +104,4 @@ Now going to `http://phpvms.test` should work. If you want to use mysql, follow
105104
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)
106105

107106
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.
107+

0 commit comments

Comments
 (0)