This repository is holds the Mindfulness webapp, built using Laravel.
The following need to be installed before starting running the application:
- PHP >= 8.3
- Composer
Check Laravel's documentation on project set-up for more information. Both of these can be installed via Larvel Herd.
-
Clone the repository:
git clone https://github.com/uconndxlab/mindfulness.git
-
Navigate to the project directory:
cd mindfulness
-
Install Composer dependencies:
composer install
-
Install Node dependencies:
npm install
-
Create a copy of the
.env.example
file and rename it to.env
:cp .env.example .env
-
Generate the application key:
php artisan key:generate
-
Run database migrations and seeding:
php artisan migrate php artisan db:seed --class=DatabaseSeeder
- If prompted to make a new sqlite database, select yes.
-
Compile assets, watch for changes, and serve:
npm run serve
-
Follow link provided by pervious command to view site, typically
http://localhost:8000
.
-
Open your terminal.
-
Open the crontab file for editing by running:
crontab -e
-
Add the following line to the crontab file to run the Laravel scheduler every minute:
* * * * * /path/to/php /path/to/your/project/artisan schedule:run >> /dev/null 2>&1
- Replace
/path/to/php
with the path to your PHP executable. You can find it by runningwhich php
in your terminal. - Replace
/path/to/your/project
with the path to your Laravel project.
- Replace
-
Save and exit the crontab file.
-
Verify that the cron job has been added by running:
crontab -l
-
Open task scheduler:
taskschd.msc
-
Create a New Task:
- In the Task Scheduler, click on
Create Task
in the right-hand Actions pane.
- In the Task Scheduler, click on
-
General Tab:
- Give your task a name, e.g., "Laravel Scheduler".
- Select "Run whether user is logged on or not".
- Check "Run with highest privileges".
-
Triggers Tab:
- Click
New
to create a new trigger. - Set the trigger to begin "On a schedule".
- Set the schedule to "Daily" and repeat the task every 1 minute, indefinitely. Select "One time" if using this in development.
- Ensure the task is enabled.
- Note: if using for development, make sure to turn off/disable the task when it is not needed.
- Click
-
Actions Tab:
- Click
New
to create a new action. - Set the action to "Start a program".
- In the "Program/script" field, enter the path to your PHP executable, e.g.,
C:\path\to\php.exe
. - In the "Add arguments (optional)" field, enter the path to your Laravel
artisan
file followed byschedule:run
, e.g.,C:\path\to\your\project\artisan schedule:run
. - In the "Start in (optional)" field, enter the directory of your Laravel project, e.g.,
C:\path\to\your\project
.
- Click
-
Conditions Tab:
- Uncheck "Start the task only if the computer is on AC power" to ensure the task runs even on battery power.
-
Settings Tab:
- Ensure "Allow task to be run on demand" is checked.
- Ensure "Run task as soon as possible after a scheduled start is missed" is checked.
- Ensure "If the task fails, restart every" is set to 1 minute and "Attempt to restart up to" is set to 3 times.
- Optionally, choose "Stop the stask if it runs longer than:", and select a time for it to shut off after you are done developing.
-
Save the Task:
- Click
OK
to save the task. - You may be prompted to enter your password to create the task.
- Click
- The command
php artisan serve
fails to bind to any ports. Link to issue.-
Solution: in
php.ini
in php installation on local device make the following change:variables_order = 'EGPCS'
to
variables_order = 'GPCS'
-
???