skobkin/magnetico-web

为 magneticod 数据库提供的简单网络搜索界面

安装: 60

依赖关系: 0

建议者: 0

安全: 0

星星: 1

Forks: 0

类型:项目


README

Build Status License

Magnetico Web PHP

Magnetico Web 是为 magneticod 数据库提供的简单网络搜索界面。

安装

应用程序设置非常简单

获取源代码

使用 Git

git clone https://skobkin@bitbucket.org/skobkin/magnetico-web.git
cd magnetico-web

使用 Composer

composer create-project skobkin/magnetico-web -s dev
cd magnetico-web

设置文件访问权限

var/cachevar/logs 设置适当的 写权限

安装依赖项(通过 Composer 安装后不需要)

# In developer environment:
composer install

# In production environment
# 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
composer install --no-dev --optimize-autoloader

在依赖项安装后,您可能需要创建 .env.local 文件(参考 .env),或为生产使用设置适当的 环境变量

有关 .env 文件的更多详细信息,请参阅 Symfony 文档

如果您正在从旧版本的项目更新,您还可以查看有关 .env 变化的这篇文章

数据库配置

有关更多详细信息,请参阅 Symfony 数据库配置 文档。

您必须为两个数据库设置环境变量:magneticod 和 magnetico-web 的 PostgreSQL。

模式考虑事项

确保 magnetico-webmagneticod 在 PostgreSQL 数据库中存储种子时使用相同的模式。请在此处查看 magneticod 文档并确保 schema 参数未设置或设置为 magneticod(默认值)。

magnetico-web 使用 magneticod 模式来搜索种子,如果您将 magenticod 设置为使用另一个模式,搜索将无法工作。

数据库模式迁移

# Only for 'default' EntityManager (Application entities)
php bin/console doc:mig:mig --em=default

安装网络资源

php bin/console assets:install public --symlink

创建用户

# see --help for more info
# If you don't specify the password it'll be requested from you in the command line
php bin/console user:add <your_username> <your_email> [your_password] [--invites=10]

向用户发送邀请

# see --help for more info
php bin/console invite:add <username> <number-of-invites>

启用开发模式

echo 'APP_ENV=dev > .env.local'

使用 RoadRunner 而不是 PHP-FPM 运行

# 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

更多信息请参阅 这里这里

可信代理

如果您在 RoadRunner 中运行应用程序并遇到正确的 URL 生成问题(HTTP 而不是 HTTPS),请检查以下 Docker 运行部分的开始。

在 Docker 中运行

Docker Compose 示例

在 Docker 中运行时,请务必 使用 Nginx 或其他反向代理服务器,并正确设置 TRUSTED_PROXIES 环境变量。您可以在此处了解更多

version: '3.7'

services:
    magnetico-web:
        image: skobkin/magnetico-web
        container_name: magnetico-web
        hostname: magnetico-web
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - "127.0.0.1:${EXT_HTTP_PORT:-8080}:8080/tcp"
        restart: unless-stopped
        user: "$UID"
        volumes:
            - "${LOG_PATH:-./var/log}:/app/var/log"
        env_file: .env
        logging:
            driver: "json-file"
            options:
                max-size: "${LOG_MAX_SIZE:-5m}"
                max-file: "${LOG_MAX_FILE:-5}"

使用 dotenv 文件配置此堆栈

# Example with some useful parameters
APP_SECRET=qwerty

APP_DATABASE_URL=postgres://magnetico-web:password@host.docker.internal:5432/magnetico-web?application_name=magnetico_web
MAGNETICOD_DATABASE_URL=postgres://magneticod:password@host.docker.internal:5432/magneticod?application_name=magnetico_web

REDIS_DSN=redis://host.docker.internal:6379/0

# BE CAREFUL WITH 'REMOTE_ADDR'. Use ONLY with trusted reverse-proxy
TRUSTED_PROXIES=127.0.0.1,REMOTE_ADDR

###> sentry/sentry-symfony ###
SENTRY_DSN=https://abcabcdaefdaef@sentry.io/123456
###< sentry/sentry-symfony ###

###> symfony/mailer ###
MAILER_DSN=smtp://mail@domain.tld:password@smtp.domain.tld:587
MAILER_FROM=no-reply@domain.tld
###< symfony/mailer ###

###> excelwebzone/recaptcha-bundle ###
EWZ_RECAPTCHA_SITE_KEY=key
EWZ_RECAPTCHA_SECRET=secret
###< excelwebzone/recaptcha-bundle ###