Giter VIP home page Giter VIP logo

fuel-packages-ratchet's Introduction

fuel-packages-ratchet


Install ZeroMQ

Install

Setup to fuel/packages/ratchet

If you use git submodule or download zip, you must install vendors

$ cd fuel/packages/ratchet
$ php composer.phar install

Configuration

In app/config/config.php

'always_load' => array('packages' => array(
	'ratchet',
	...

Copy packages/ratchet/config/ratchet.php to under app/config directory and edit

<?php

return array(
	'classes' => array(
		'default' => array(
			'domain' => 'example.com',
			'port' => '8001',
			'zmq_port' => '5555',
		),
		'Ratchet_Ws' => array(
			'domain' => 'example.com',
			'port' => '8001',
		),
		'Ratchet_Wamp' => array(
			'domain' => 'example.com',
			'port' => '8002',
			'zmq_port' => '5555',
		),
	),
);

Usage

$ php oil r ratchet:help

Run with Supervisor

# Install with easy_install command
$ sudo easy_install supervisor

# Generate configure file
$ echo_supervisord_conf > fuel/packages/ratchet/supervisor.conf

Example for supervisor.conf

Add the following
My_Ratchet_Ws is fuel/app/classes/my/ratchet/ws.php that extends Ratchet_Ws

[program:ratchet]
environment             = FUEL_ENV=production
command                 = php oil r ratchet:ws My_Ratchet_Ws
numprocs                = 1
autostart               = true
autorestart             = true
user                    = root
stdout_logfile          = fuel/app/logs/supervisor/info.log
stdout_logfile_maxbytes = 1MB
stderr_logfile          = fuel/app/logs/supervisor/error.log
stderr_logfile_maxbytes = 1MB

Example Commands

# In FuelPHP project root

# Up
$ sudo supervisord -c fuel/packages/ratchet/supervisor.conf

# Check Status
$ sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf status

# Stop
$ sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf stop all

# Start
$ sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf start all

# Restart
$ sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf restart all

Example Commands with Makefile

# make up
up:
	@echo 'Please manually run the following command:'
	@echo 'sudo supervisord -c fuel/packages/ratchet/supervisor.conf'

# make down
down:
	sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf stop all && sudo rm /tmp/supervisor.sock

# make start-all
start-all:
	sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf start all

# make stop-all
stop-all:
	sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf stop all

# make restart-all
restart-all:
	sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf restart all

# make status
status:
	sudo supervisorctl -c fuel/packages/ratchet/supervisor.conf status

# make help
help:
	@echo 'Commands:'
	@echo '  make up'
	@echo '  make down'
	@echo '  make start-all'
	@echo '  make stop-all'
	@echo '  make restart-all'
	@echo '  make status'

License

Copyright 2013, Mamoru Otsuka. Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.