This is the server side and webapp of GLPI Plugin Directory.
It is the future of http://plugins.glpi-project.org
clone this repository where you are able to serve it via PHP and a webserver.
cd somewhere
git clone git@github.com:glpi-project/plugins.git glpi-plugin-directory
in the folder where you cloned this repo, run
cd api
composer install
in the folder where you cloned this repo, run
cd frontend
npm install
bower install
grunt build
First, create a MySQL database, and user, which you grant CRUD and CREATE rights on the database.
mysql -u <usercreated> -p<password> <database>
CREATE DATABASE <database> CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON glpiplugindirectory.* TO '<usercreated>'@'localhost' IDENTIFIED BY '<password>'
in the folder where you cloned this repo, run
mysql -u <usercreated> -p<password> <database> < misc/structure.sql
be sure to replace <usercreated> <password> and <database> with the database and user you created previously.
You must create api/config.php
file and frontend/app/scripts/conf.js
Both of them have example provided that you can use to start a new one.
api/config.example.php
frontend/app/scripts/conf.example.js
This is the original list of XML Plugin declaration files Indepnet was tracking, it is the the data on which we built this new plugin directory. We added a way to copy that original list into a fresh database, described here
in the folder where you cloned this repo, run
php misc/loadcsv.php -h hostname -d database -u username -p password -f misc/indepnet.csv
you can give the indepnet.csv file provided in misc with the -f command line option shown in the example before.
php misc/update.php
It is up to you to use a crontab entry to run this script, per example once every hour.
This is a configuration example for Apache HTTPd :
<VirtualHost *:80>
ServerName glpiplugindirectory
DocumentRoot "/path/to/frontend/dist"
<Directory "/path/to/glpi-plugin-directory">
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Location /api>
RewriteEngine On
# Cross domain access (you need apache header mod : a2enmod headers)
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type, x-lang, x-range, accept"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Header add Access-Control-Expose-Headers "content-type, content-range, accept-range"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</Location>
Alias /api "/path/to/api"
ErrorLog "/usr/local/var/log/apache2/glpiplugindirectory.error.log"
CustomLog "/usr/local/var/log/apache2/glpiplugindirectory.access.log" common
</VirtualHost>
This is a configuration example for NGINX :
upstream php {
server unix:/var/run/php-fpm/php-fpm.sock;
}
server {
listen 80;
server_name glpiplugindirectory;
root /path/to/glpi-plugin-directory/frontend/dist;
index index.html;
}
server {
listen 80;
server_name api.glpiplugindirectory;
root /path/to/glpi-plugin-directory/api;
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Headers "origin, x-requested-with, content-type, x-lang, x-range, accept";
add_header Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS";
add_header Access-Control-Expose-Headers "content-type, content-range, accept-range";
try_files $uri $uri/ /index.php?$args;
index index.php;
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
}
This is if you develop locally on the frontend side of glpi-plugin-directory
cd frontend
grunt serve