Skip to content

AnimeThemes/animethemes-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

681 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

tests static-analysis StyleCI

AnimeThemes is a simple and consistent repository of anime opening and ending themes. We provide direct links to high quality WebMs of your favorite OPs and EDs for your listening and discussion needs.

This is the repository for the server application that is responsible for AnimeThemes.moe resource management, API, and other services related to serving the AnimeThemes database.

This project is powered by Laravel, a PHP framework for web artisans.

Installation

Prerequisites

A LAMP stack, such as XAMPP, can also be used to set up Apache, MySQL, and PHP.

Alternatively, you may use Laravel Herd, which provides a simple local development environment with PHP and a web server.

Pre Setup

PHP

We should ensure that we have the following extensions enabled for php in php.ini.

fileinfo - Needed to detect MIME type of files during seeding.

gd - Needed to fake image files for testing.

pdo_mysql - Needed to use MySQL.

In order to accept video uploads, we should ensure that php will accept requests of adequate sizes.

Set post_max_size to 200M.

Set upload_max_filesize to 200M.

Setup

# Clone the repository
git clone git@github.com:AnimeThemes/animethemes-server.git
cd animethemes-server

# Create the database
mysql -h localhost -u root -p -e "CREATE DATABASE IF NOT EXISTS ``animethemes`` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

# Install dependencies, migrate the database, run seeders and import dumps
composer setup

Web Server

Laravel Herd

# Run the following in the project directory:
herd link animethemes.test

Running

After installation, restart the web server to apply the configuration.

If all went well, AnimeThemes should be live at http://animethemes.test (or whatever set the server name is set to).

Extra Configuration

Feature Flags

Features that require external services are disabled by default. Here we will review the configuration options for enabling additional features.

For example, if we want to enable video streams, we need to set the App\Features\AllowVideoStreams value on DB to true. We recommend setting up a local archive for the videos_local disk.

Users

# Open the terminal of tinker
php artisan tinker

# Create the user
$user = User::factory()->create(['name' => 'User Name', 'email' => 'example@example.com', 'password' => 'password', 'email_verified_at' => now()]);

# It is useful to create a user with the Admin role with permissions to all actions
# Assign the Admin role to the user
$user->assignRole('Admin');

Elasticsearch

If we want to enable scout, we need to configure Elasticsearch.

If we have installed Elasticsearch, migrate and import models into our indices using:

# Run the elastic migrations
php artisan elastic:migrate

# Import Models with a seeder
php artisan db:seed --class="Database\Seeders\Scout\ImportModelsSeeder"

Local Storage

We are not required to set up s3 buckets in order to interact with media. We have the option to configure local filesystems that we can stream audio/video from and download scripts/dumps from.

Configure local filesystem disks in .env

AUDIO_DISK_DEFAULT=audios_local
AUDIO_DISKS=audios_local
...
DUMP_DISK=dumps_local
...
IMAGE_DISK=images_local
...
VIDEO_DISK_DEFAULT=videos_local
VIDEO_DISKS=videos_local
...
SCRIPT_DISK=scripts_local

By default, app storage directories will be used to store media. External directories can be specified as the root if media is stored elsewhere.

Remark: It is recommended to include a .gitignore at the root directory of the filesystem so that media files are not indexed by git.

AUDIO_DISK_ROOT="E:\\animethemes-audios\\"
...
DUMP_DISK_ROOT="E:\\animethemes-db-dumps\\"
...
IMAGE_DISK_ROOT="E:\\animethemes-images\\"
...
SCRIPT_DISK_ROOT="E:\\animethemes-scripts\\"
...
VIDEO_DISK_ROOT="E:\\animethemes-videos\\"

Create symbolic links to target storage directories.

php artisan storage:link

Contributing

Please review the Contributing Guide in the wiki for detailed instructions.

Resources

Please make use of the #api channel in the Discord Server for questions pertaining to the AnimeThemes database or API.

About

AnimeThemes.moe resource management & API

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Contributors 4

  •  
  •  
  •  
  •  

Languages