Skip to content

Commit

Permalink
Merge pull request #20 from karlomikus/develop
Browse files Browse the repository at this point in the history
Next version
  • Loading branch information
karlomikus committed Nov 21, 2022
2 parents da9b517 + 865ae1a commit 241d187
Show file tree
Hide file tree
Showing 34 changed files with 2,029 additions and 776 deletions.
4 changes: 2 additions & 2 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ APP_URL=
DB_CONNECTION=sqlite

BROADCAST_DRIVER=log
CACHE_DRIVER=file
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_DRIVER=redis
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# v0.5.0
- Use redis for session and cache
- Automatically select some ingredients when running the application for the first time
- Add OpenAPI specification and `/docs` route
- Fixed an error response when adding ingredient to the shelf from shopping list
- Updated some endpoints to be more consistent
- Include substitute ingredients when showing a list of shelf cocktails
- Added debugbar
- Remove the need to run `chown` in docker container
- Add demo environment support

# v0.4.1
- Enable opcache in docker image
- Cache route and config in docker image
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ RUN apt update \
&& apt-get autoremove -y \
&& apt-get clean

RUN docker-php-ext-install opcache
RUN docker-php-ext-install opcache \
&& pecl install redis \
&& docker-php-ext-enable redis

# Setup default apache stuff
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
Expand All @@ -27,6 +29,8 @@ RUN chmod +x /usr/local/bin/entrypoint
# Add composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

USER www-data:www-data

WORKDIR /var/www/cocktails

RUN git clone https://github.com/karlomikus/bar-assistant.git .
Expand Down
73 changes: 45 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@

## 🍸 Bar assistant

Bar assistant is a self hosted application for managing your home bar. It allows you to add ingredients and create custom cocktail recipes.
Bar assistant is a self hosted application for managing your home bar. It allows you to add your ingredients, search for cocktails and create custom cocktail recipes.

This repository only contains the API server, if you are looking for easy to use web client, take a look at [Salt Rim](https://github.com/karlomikus/vue-salt-rim).

Note: This application is still in development and there will be breaking changes and loss of data. I do not recommend using this in a "production" environment until a stable version is released.

## Features

- Includes all current IBA cocktails
- Over 100 ingredients
- Endpoints for managing of ingredients and cocktails
Expand All @@ -26,32 +23,55 @@ Note: This application is still in development and there will be breaking change
- Ability to upload and assign images
- Shopping list for missing ingredients
- Automatic indexing of data in Meilisearch
- Cocktail ingredient substitutes
- Assign glass types to cocktails

## Planned features

- Cocktail recipe sharing
- Cocktail and shopping list printing
- User defined cocktail collections
- Cocktail ratings
- Add user notes to cocktail
- Add cocktail flavor profiles
- Ingredient and cocktail aliasing
- Ingredient substitutes
- Cocktail recipe scraping
- Importing and exporting cocktails

## Installation

This application is made with Laravel, so you should [follow installation instructions](https://laravel.com/docs/9.x/deployment) for a standard Laravel project.
This application is made with Laravel, so you should check out [deployment requirements](https://laravel.com/docs/9.x/deployment) for a standard Laravel project.

### Requirements:
The basic requirements are:

- PHP >=8.1
- PHP >= 8.1
- Sqlite 3
- Working [Meilisearch server](https://github.com/meilisearch)
- Working [Meilisearch server](https://github.com/meilisearch) instance
- (Optional) Redis server instance

## Docker setup

Docker setup is the easiest way to get started. This will run only the server but you can [checkout how to setup the whole Bar Assistant stack here.](https://github.com/bar-assistant/docker)

``` bash
$ docker volume create bass-volume

$ docker run -d \
--name bar-assistant \
-e APP_URL=http://localhost:8000 \
-e MEILISEARCH_HOST=http://localhost:7700 \
-e MEILISEARCH_KEY=masterKey \
-e REDIS_HOST=redis \
-v bass-volume:/var/www/cocktails/storage \
-p 8000:80 \
kmikus12/bar-assistant-server
```

Docker image exposes the `/var/www/cocktails/storage` volume, and there is currently and issue with host permissions if you are using a local folder mapping.

### Meilisearch

Bar Assistant is using Meilisearch as a primary Scout driver. It's used to index cocktails and ingredients used for filtering and full text search.
Bar Assistant is using Meilisearch as a primary [Scout driver](https://laravel.com/docs/9.x/scout). It's main purpose is to index cocktails and ingredients and power filtering and searching on the frontend. Checkout [this guide here](https://docs.meilisearch.com/learn/cookbooks/docker.html) on how to setup Meilisearch docker instance.

### Setup
## Manual setup

After cloning the repository, you should do the following:

Expand All @@ -68,6 +88,12 @@ APP_URL=
MEILISEARCH_HOST=
# Meilisearch search key
MEILISEARCH_KEY=
# If using redis, the following
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
CACHE_DRIVER=redis
SESSION_DRIVER=redis
```

2. Run the commands
Expand All @@ -79,32 +105,23 @@ $ php artisan key:generate
$ php artisan storage:link

# To setup the database:
$ php artisan migrate
$ php artisan migrate --force

# To fill the database with data
$ php artisan bar:open
```

Default login information is:
## Usage

Checkout `/docs` route to see endpoints documentation.

Default login information is:
- email: `[email protected]`
- password: `password`

## Docker

[Also checkout how to setup the whole Bar Assistant stack here.](https://github.com/karlomikus/vue-salt-rim#docker-compose)

``` bash
docker run -d \
-e APP_URL=http://localhost:8080 \
-e MEILISEARCH_HOST=http://localhost:7700 \
-e MEILISEARCH_KEY=maskerKey \
kmikus12/bar-assistant-server
```

## Contributing

TODO
TODO, Fork and create a pull request...

## License

Expand Down
48 changes: 48 additions & 0 deletions app/Console/Commands/BarSearchRefresh.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Kami\Cocktail\Console\Commands;

use Illuminate\Console\Command;
use Kami\Cocktail\SearchActions;
use Illuminate\Support\Facades\Artisan;

class BarSearchRefresh extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bar:refresh-search';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Refresh search index';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
// Clear indexes
// SearchActions::flushSearchIndex(); // TODO: Create method to import site_index
$this->info('Removing cocktails and ingredients index...');
Artisan::call('scout:flush', ['model' => "Kami\Cocktail\Models\Cocktail"]);
Artisan::call('scout:flush', ['model' => "Kami\Cocktail\Models\Ingredient"]);

// Update settings
$this->info('Updating index settings...');
SearchActions::updateIndexSettings();

$this->info('Importing cocktails and ingredients...');
Artisan::call('scout:import', ['model' => "Kami\Cocktail\Models\Cocktail"]);
Artisan::call('scout:import', ['model' => "Kami\Cocktail\Models\Ingredient"]);

return Command::SUCCESS;
}
}
Loading

0 comments on commit 241d187

Please sign in to comment.