Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
khaydarov Override Yaml config according to the environment (#17)
* Override yaml config according to the environment

* refactor

* create docs about configuration installation

* update
Latest commit 9c23480 Apr 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Override Yaml config according to the environment (#17) Apr 23, 2019
bin Improve project layout (#14) Apr 10, 2019
docker Improve project layout (#14) Apr 10, 2019
docs
public
src
tests
.env.example
.gitignore
.php_cs Improve project layout (#14) Apr 10, 2019
README.md
composer.json
composer.lock
docker-compose.yml
phpunit.xml Improve project layout (#14) Apr 10, 2019

README.md

The GraphQL-API-Server of "uptime-monitor" project

Easy to use API to save/retrieve all data, related to monitor project.

Available API methods

Create Project

mutation CreateProject {
    project(
        name:"HAWK",
        url:"https://hawk.so",
        webhooks: [
            "https://notify.bot.ifmo.su/u/iaUh78",
            "https://notify.me/iuaSD78"
        ]
    ){
        name,
        url,
        webhooks
    }
}

Update Project

mutation UpdateProject {
    project(
        id:"5a70ac62e1d8ff5cda8322a0",
        name:"Capella",
        url:"https://capella.pic",
        webhooks: [
            "https://notify.bot.ifmo.su/u/iaUh78",
            "https://notify.me/iuaSD78"
        ] 
    ){
        name,
        url,
        webhooks
    }
}

Parameters

Parameter Type Description
ID String Projects's unique identifier. 24-character hexadecimal string
name String Project's name
url String Project's URL

Retrieve all projects

query AllProjects {
    projects {
        name,
        url,
        webhooks
    }
}

How to send a request?

To test API you can use Insomnia
For cURL request to GraphQL it looks like:

curl -X POST -H "Content-Type: application/json" \ 
--data '{ "query": "{ projects { name, url } }" }' https://api.monitor.ifmo.su 

Deployment

Docker

  1. Download and setup Docker from the official site
  2. In project root directory run docker-compose up --build

Server

  1. Install PHP@7.2 with required dependencies
add-apt-repository ppa:ondrej/php
apt-get install nginx php php-pear php-dev php-mbstring unzip -y
pecl install mongodb
  1. Configure php.ini file to add extension=mongodb.so
php --ini
(path for example will be – Loaded Configuration File: /usr/local/etc/php/7.2/php.ini)
echo "extension=mongodb.so" >> /usr/local/etc/php/7.2/php.ini
  1. Follow this link to install the correct version of MongoDB
  2. Follow this link to install Composer and then make it global
  3. Configure your nginx according to this article
You can’t perform that action at this time.