the personal food nutrition journal
Go to file
Christopher C. Wells 264a194202 Remove media handling from database seeder 2021-04-08 07:49:33 -07:00
.github Update CI config 2021-04-05 16:30:27 -07:00
app Finalize fake data improvements 2021-04-07 21:28:05 -07:00
bootstrap Initial commit -- Laravel base app 2020-12-21 09:46:31 -08:00
config Set default app name to kcal 2021-04-07 22:03:08 -07:00
database Remove media handling from database seeder 2021-04-08 07:49:33 -07:00
elastic/migrations Use babenkoivan Elasticsearch ecosystem 2021-03-04 22:17:33 -08:00
public Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
resources Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
routes Remove unused auth routes 2021-04-06 11:24:20 -07:00
storage Remove media handling from database seeder 2021-04-08 07:49:33 -07:00
tests Remove inconsistent fraction tests 2021-04-07 21:39:51 -07:00
.editorconfig Initial commit -- Laravel base app 2020-12-21 09:46:31 -08:00
.env.ci.example Update CI config 2021-04-05 16:30:27 -07:00
.env.local.example Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
.env.prod.example Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
.gitattributes Initial commit -- Laravel base app 2020-12-21 09:46:31 -08:00
.gitignore Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
.phpstorm.meta.php Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
.styleci.yml Initial commit -- Laravel base app 2020-12-21 09:46:31 -08:00
ATTRIBUTIONS.md Remove icon nav elements 2021-03-27 21:01:34 -07:00
LICENSE Add LICENSE file 2021-01-03 14:30:18 -08:00
Procfile Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
README.md Use `main` branch in Coveralls badge 2021-04-06 13:29:58 -07:00
_ide_helper.php Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
app.json Revert "Add demo data in `postdeploy`" 2021-04-07 21:45:23 -07:00
artisan Initial commit -- Laravel base app 2020-12-21 09:46:31 -08:00
composer.json Add Words class for random food-related words 2021-04-07 08:46:18 -07:00
composer.lock Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
docker-compose.yml Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
package-lock.json Update to PostCSS 8 2021-04-02 23:54:12 -07:00
package.json Update to PostCSS 8 2021-04-02 23:54:12 -07:00
phpstan.neon.dist Add phpstan support 2021-01-24 19:43:59 -08:00
phpunit.xml.dist Add Heroku support (#12) 2021-04-06 10:05:10 -07:00
server.php Initial commit -- Laravel base app 2020-12-21 09:46:31 -08:00
tailwind.config.js Add frontend support for Quill JSON strings 2021-03-08 08:40:36 -08:00
webpack.mix.js Add Quill editor for recipe description 2021-03-08 08:40:36 -08:00

README.md

kcal the personal food nutrition journal

CI Status Coverage Status

Deployment

Heroku

Deploy

The default username and password for a Heroku deployment is kcal/kcal.

Using Heroku CLI

For a manual deploy using Heroku CLI, execute the following after initial deployment:

heroku run php artisan migrate
heroku run php artisan user:add
heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)

Search drivers

See the Search section for information about supported drivers. Additional environment variable configuration is necessary when using any search driver other than the default ("null").

Redis Add-on

The Heroku Redis add-on can be added to the app and will work without any configuration changes. It is left out of the default build only because it takes a very long time to provision.

Search 🔍

The "ingredient" (food or recipe) search for journal entries and recipe ingredients supports three different backends using the SCOUT_DRIVER environment variable. In all cases, always ensure that the SCOUT_DRIVER environment variable is only set once in kcal's .env file.

Currently, the food and recipe list searches do not take advantage of these search drivers. Support for those searches will be added if the Laravel JSON:API adds support for Scout (see: laravel-json-api/laravel#32).

Algolia (algolia)

  1. Create and/or log in to an Algolia account.

  2. Create an application for kcal.

  3. Navigate to the application's "API Keys" section.

  4. Using the Application ID and Admin API Key values, update kcal's .env file:

     SCOUT_DRIVER=algolia
     ALGOLIA_APP_ID=<APPLICATION_ID>
     ALGOLIA_SECRET=<ADMIN_API_KEY>
    

ElasticSearch (elastic)

  1. Determine the host and port for your ElasticSearch service.

  2. Update kcal's .env file.

     SCOUT_DRIVER=elastic
     ELASTIC_HOST=<HOST:PORT>
     ELASTIC_PORT=<PORT>
    

    Note: The ELASTIC_PORT variable is a convenience option specifically for Docker Compose configurations and is not strictly required.

  3. Run Elastic's migrations.

     php artisan elastic:migrate
    

Fallback (null)

The fallback driver is a simple WHERE ... LIKE clause search on a couple of key fields. Results will not be ordered by relevance, and some fields will not be searched (e.g. the tags fields). Using one of the other options is highly recommended.

Set SCOUT_DRIVER=null in kcal's .env file to use the fallback driver.

Development

Laravel Sail

Prerequisites

  1. Clone the repository.

     git clone https://github.com/kcal-app/kcal.git
    
  2. Move in to the cloned folder.

     cd kcal
    
  3. Install development dependencies.

     composer install
    
  4. Create a local .env file.

     cp .env.local.example .env
    

    Note: the default APP_URL setting is http://127.0.0.1. If you have dnsmasq or something similar configured for the test domain you can change this to http://kcal.test.

  5. Generate an app key.

     touch .env
     php artisan key:generate
    
  6. Run it!

     vendor/bin/sail up -d
    
  7. (On first run) Run migrations.

     vendor/bin/sail artisan migrate
     vendor/bin/sail artisan elastic:migrate
    
  8. (On first run) Create the initial user.

     vendor/bin/sail artisan db:seed --class UserSeeder
    

    The default username and password is admin@kcal.test.

Once the application finishes starting, navigate to http://127.0.0.1:8080 (or http://kcal.test:8080 if configured).