Skip to content

Installation (feature elasticsearch)

Irfan edited this page Apr 10, 2022 · 4 revisions

⚠ DO NOT use this guide. This is for the feature/elasticsearch branch only which is currently under development.


🐳 Docker Installation

Not available.

Manual Installation

This installation guide is for Jikan REST API v4 only.

  • PHP 8.0

  • Composer 2

  • Git

  • MongoDB*

    • Does not require a self-managed installation, you can connect to a cloud-managed MongoDB instance as well
  • Elasticsearch*

    • Does not require a self-managed installation, you can connect to a cloud-managed Elasticsearch instance as well
  • Apache (optional)

✅ Tested with Ubuntu 20


Getting Started

Prerequisites

  1. Install Git and build-essentials for compiling the PHP MongoDB Driver
    • sudo apt install git build-essential
  2. Install PHP 8.0
  3. Install Required PHP 8.0 dependencies
    • sudo apt install php8.0-{xml,mbstring,common,curl,pear}
    • Note: pear will install PECL for you
  4. Install PHP MongoDB Driver
    • sudo pecl install mongodb
    • Add extension=mongodb.so to your php.ini (On Ubuntu 20 it will be in /etc/php/8.0/)

Installing Jikan REST API v4

  1. Clone the repo in /var/www
    • git clone https://github.com/jikan-me/jikan-rest.git
    • Jikan REST API v4 will now be in /var/www/jikan-rest
    • Change Directory: cd jikan-rest
  2. If you haven't installed Composer 2 yet, now's the time
  3. Make sure you have appropriate write permissions for /var/www/jikan-rest
  4. Install Jikan REST API v4 dependencies
    • composer install (If you have Composer installed Globally.
    • php path/to/composer.phar install
  5. Copy Environment variables
  6. Run Database Migrations with php artisan migrate
  7. Enable the scheduler by adding it to corntab -e
    • * * * * * cd /var/www/jikan-rest && php artisan schedule:run >> /dev/null 2>&1
    • You can modify the scheduler here

Ignition

For Development

  • For Development purposes, you can use PHP's own built-in webserver

Apache

You can use Apache to host the Jikan REST API (it's what I use personally too)

  1. sudo apt install apache2
  2. Set AllowOverride All in /etc/apache2/apache2.conf inside <Directory /var/www/>
  3. Edit your virtual host document root
    • By default it's in /etc/apache2/sites-available/000-default.conf: DocumentRoot /var/www/jikan-rest/public
    • If you have other sites, you can set up a different virtual host (Learn More)
  4. Enable Mod Rewrite and Mod Deflate (for GZIP'd responses)
    • sudo a2enmod deflate && sudo a2enmod rewrite
  5. Restart the Apache server
    • sudo service apache2 restart

Your very own Jikan REST API v4 is now good to go! - Tune into http://localhost/v4 to access the API

Nginx/Other Web Servers

  • ℹ️ If you wish to configure it for Nginx or anything else, you'll have to port the rewrite rules located at public/.htaccess

Configuration

https://github.com/jikan-me/jikan-rest/wiki/Configuration

Using Elasticsearch


Troubleshooting

Please read the troubleshooting guide. For any additional help, join our Discord server.

Artisan Commands

Please read the commands guide. For any additional help, join our Discord server.

Information

If you don't want to host your instance, there's a public API available.

Wrappers

See the list of wrappers here