/swoole-boilerplate

Swoole boilerplate

Primary LanguagePHPMIT LicenseMIT

Swoole boilerplate

Swoole boilerplate

Requirements

Docker

GNU Make

Install

Clone the repository:

$ git clone https://github.com/oligus/swoole-bolierplate.git

Initialize the docker containers, in total there are 4 containers: nginx, mysql, http and cli.

$ make build

Get the IP number of the http instance:

$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' swoole_http

Setup MYSQL:

$ make bash-mysql
$ mysql -uroot -pswoole_root

Create database and add users from http and cli

create database swoole;

CREATE USER 'swoole'@'172.30.0.%' IDENTIFIED WITH mysql_native_password BY 'swoole';
GRANT ALL PRIVILEGES ON swoole.* TO 'swoole'@'172.30.0.%';

Check your database access:

$ make bash-swoole
$ mysql -u swoole -pswoole -h mysql -D swoole
$ make bash
$ mysql -u swoole -pswoole -h mysql -D swoole

Create database (CLI):

$ vendor/bin/doctrine orm:schema-tool:create

Put in sample data (CLI):

$ mysql -uswoole -pswoole -h mysql -D swoole < data/sample.sql 

GraphQL

Nginx will be serving from port 8085

Access GraphQL end point from http://localhost:8085