2022-07-10 23:24:23 +00:00
[![Build Status ](https://ci.skobk.in/api/badges/skobkin/magnetico-web/status.svg )](https://ci.skobk.in/skobkin/magnetico-web)
2018-06-22 15:43:19 +00:00
[![License ](https://poser.pugx.org/skobkin/magnetico-web/license )](https://packagist.org/packages/skobkin/magnetico-web)
# Magnetico Web PHP
Magnetico Web is a simple web search interface for [magneticod ](https://github.com/boramalper/magnetico ) database.
# Installation
Application setup is quite simple:
## Getting the source code
### Using Git
```bash
git clone https://skobkin@bitbucket.org/skobkin/magnetico-web.git
cd magnetico-web
```
### Using Composer
```bash
composer create-project skobkin/magnetico-web -s dev
cd magnetico-web
```
## Setting file access privileges
Set up appropriate [write permissions ](https://symfony.com/doc/current/setup/file_permissions.html ) for `var/cache` and `var/logs` .
## Installing dependencies (not needed after installation via Composer)
```bash
# In developer environment:
composer install
2021-02-20 14:12:41 +00:00
2018-06-22 15:43:19 +00:00
# In production environment
2021-02-20 14:12:41 +00:00
# You should tell the app that it's running in the production environment.
# You can use environment variables or set it in the .env.local file like that:
echo 'APP_ENV=prod' > ./.env.local
2018-06-22 15:43:19 +00:00
composer install --no-dev --optimize-autoloader
```
2021-02-20 14:12:41 +00:00
After dependencies installation you may need to create `.env.local` file (see `.env` for reference)
2018-06-22 15:43:19 +00:00
or set appropriate [environment variables ](https://en.wikipedia.org/wiki/Environment_variable )
for production usage.
2020-12-15 14:27:45 +00:00
Check [Symfony documentation ](https://symfony.com/doc/5.1/configuration.html#overriding-environment-values-via-env-local ) for more details about `.env` files.
You can also check [this post ](https://symfony.com/doc/5.1/configuration/dot-env-changes.html ) about `.env` changes in Symfony if you're updating from an
old version of the project.
2018-06-22 15:43:19 +00:00
## Database configuration
See [Symfony database configuration ](https://symfony.com/doc/current/doctrine.html#configuring-the-database )
documentation for more details.
2020-01-17 22:04:21 +00:00
You **must** set environment variables for both databases: magneticod's and magnetico-web's PostgreSQL.
2019-01-01 15:35:35 +00:00
2021-02-20 14:12:41 +00:00
### Schema considerations
Make sure that `magnetico-web` and `magneticod` are using the same schema for storing torrents in the PostgreSQL database.
Check `magneticod` docs [here ](https://github.com/boramalper/magnetico/tree/master/pkg#postgresql-database-engine-only-magneticod-part-implemented )
and make sure that `schema` parameter either not set or set to `magneticod` (default value).
`magnetico-web` uses `magneticod` schema to search for torrents so if you set `magenticod` to use another schema search **will not work** .
2019-01-01 15:35:35 +00:00
## Database schema migration
```bash
2020-12-15 14:27:45 +00:00
# Only for 'default' EntityManager (Application entities)
php bin/console doc:mig:mig --em=default
2019-01-01 15:35:35 +00:00
```
2020-12-19 22:53:01 +00:00
## Web assets installation
```bash
php bin/console assets:install public --symlink
```
2019-01-01 15:35:35 +00:00
## User creation
```bash
# see --help for more info
# If you don't specify the password it'll be requested from you in the command line
2020-12-15 14:27:45 +00:00
php bin/console user:add < your_username > < your_email > [your_password] [--invites=10]
2019-01-01 15:35:35 +00:00
```
2020-12-19 22:53:01 +00:00
## Giving invites to the user
2018-06-22 15:43:19 +00:00
```bash
2020-12-19 22:53:01 +00:00
# see --help for more info
php bin/console invite:add < username > < number-of-invites >
2019-12-27 22:20:39 +00:00
```
2022-07-05 23:17:26 +00:00
## Enabling dev mode
```shell
echo 'APP_ENV=dev > .env.local'
```
## Running in [RoadRunner](https://roadrunner.dev)
```shell
# First time only:
./vendor/bin/rr get --location bin/
# Running the server:
./bin/rr serve
# Running the server in dev mode (watching enabled)
bin/rr serve -c .rr.dev.yaml
```
Read more [here ](https://github.com/baldinof/roadrunner-bundle ) and [here ](https://github.com/roadrunner-server/roadrunner ).