<commit_before>LANager
=======

LANager is a web application designed to make [LAN Parties](https://en.wikipedia.org/wiki/Lan_party)
more enjoyable for attendees and organisers alike.

## Goals & Features

* Enhance participation
	* [Games in progress](http://zeropingheroes.co.uk/wp-content/gallery/lanager/games.png) updated every minute from Steam
	* [Servers being played on](http://zeropingheroes.co.uk/wp-content/gallery/lanager/servers.png) with join links, again from Steam
	* [Events](http://zeropingheroes.co.uk/wp-content/gallery/lanager/lanager-timetable.png) system optionally allowing users to [join events](http://zeropingheroes.co.uk/wp-content/gallery/lanager/event-signups.png)
	* [Shouts](http://zeropingheroes.co.uk/wp-content/gallery/lanager/shouts.png) allowing advertising of games
	* [Files](http://zeropingheroes.co.uk/wp-content/gallery/lanager-old/files.png) that may be required to join in *
* Boost social interaction
	* [Attendee profiles](http://zeropingheroes.co.uk/wp-content/gallery/lanager/profile.png) with links to add or message on Steam
	* [List of attendees](http://zeropingheroes.co.uk/wp-content/gallery/lanager/people.png) with their current status
* Broadcast information
	* [Info pages](http://zeropingheroes.co.uk/wp-content/gallery/lanager/info_0.png) so that everyone can find out about the venue, food or tournament rules  
	* [Links](http://zeropingheroes.co.uk/wp-content/gallery/lanager/links.png) to other sites e.g. game stats, organiser's website 
* Allow attendee feedback
	* [Request music & videos](http://zeropingheroes.co.uk/wp-content/gallery/lanager/playlist.png) for play-out on a big screen
	* [Watch & listen](http://zeropingheroes.co.uk/wp-content/gallery/lanager-old/playlist_screen.png) to requested music & videos
* API access
	* Allow user status, game and server information for non-steam applications to be used *
	* Make data available for events, users, info pages, shouts, videos etc *
	* Generally avoid tying the project to the Steam platform *
* Much more
	* Check the [issue tracker](https://github.com/zeropingheroes/lanager-core/issues?labels=enhancement&milestone=&page=1&state=open) for more planned enhancements

\* *Planned but not yet implemented*

## Requirements
* Windows / Linux / OS X
* Apache / nginx Web server
* PHP 5.5 (with cURL & MCrypt)
* MySQL
* [Composer](https://getcomposer.org/)
* [Steam API Key](http://steamcommunity.com/dev/apikey)
* An Internet connection
* Shell access to the server - **web hosting alone will not work!** *

WAMP, LAMP and MAMP are a quick way to satisfy most of the above, just check that the version you download includes PHP 5.4+

\* *Steam user states are updated using a batch script so you must be able to run commands and schedule tasks / cron jobs* 

## Installation

Do not download the source in a zip file directly from GitHub - if you do updating will be difficult!

1. Download and install [Composer](http://getcomposer.org/download/) and [Git](http://git-scm.com/downloads)

2. In a terminal in the directory you wish to install the project into, run:

	`git clone https://github.com/zeropingheroes/lanager.git`

3. Install the project's dependencies by running:

	`composer update`

4. Configure your web server to use `lanager/public/` as the root web directory

5. Configure your web server for "[pretty URLs](http://laravel.com/docs/4.2/installation#pretty-urls)" e.g. `lanager/user/1` etc
	1. On Apache [enable the URL rewriting module](http://stackoverflow.com/questions/869092/how-to-enable-mod-rewrite-for-apache-2-2) `mod_rewrite`:
		1. Set [`AllowOverride All`](http://stackoverflow.com/questions/18740419/how-to-set-allowoverride-all) on your `lanager/app/public` directory
		2. Run `a2enmod rewrite` from the command line
		3. Restart Apache
       
	2. On nginx use the following in your site config and restart nginx:

        `location / { try_files $uri $uri/ /index.php?$query_string; }`

6. Change the permissions for the `lanager/app/storage/` directory to be read & write for your web server:

	`chmod -R 777 lanager/app/storage` (*nix)
	
7. Create a MySQL user and database, both named `lanager` and grant the required privileges:
    
	1. In a terminal run: `mysql -u root -p`
	2. Type your MySQL root user password
	3. Once you are at the mysql> prompt, run each of the following in turn:
	4. `CREATE DATABASE lanager;`
	5. `CREATE USER 'lanager'@'localhost' IDENTIFIED BY 'type a secure password here';`
	6. `GRANT ALL PRIVILEGES ON lanager.* TO 'lanager'@'localhost';`
	7. `FLUSH PRIVILEGES;`

8. In `lanager/app/config/database.php` set the database password you chose above

9. In a terminal in the `lanager/` directory, run:

	`php artisan lanager:install`

10. Schedule the artisan command `steam:import-user-states` to run at 1 minute intervals

	* On Windows
		* Add a task for `lanager/SteamImportUserStates.bat` in [Task Scheduler](http://support.microsoft.com/kb/226795)

	* On *nix
		1. Make `lanager/SteamImportUserStates.sh` executable:
			`sudo chmod +x SteamImportUserStates.sh`
		2. From a terminal run `crontab -e`
		3. Add the following to the end of the file:
		`*/1 * * * * /path/to/lanager/SteamImportUserStates.sh >> /dev/null 2>&1`

## Usage

Once you have completed the installation, you can sign in via Steam. The first user to sign in will be granted the SuperAdmin role, allowing you to assign roles to other users.

Look through the configuration files inside `lanager/app/config/lanager/` which will allow you to tailor your installation to your event.  

*This section will be expanded upon as features are solidified.*

## Updating

To update to the latest version, back up your config files and from the `lanager/` directory simply run the following commands:

1. `git reset --hard`
	* This will reset all files to their defaults!
2. `git pull origin`
2. `composer update`
3. `php artisan lanager:install`
	* When asked, choose to continue with the installation
	* Emptying the database is recommended but optional

Once the above has run, refer to your backed up config files and manually replicate the settings in the new config files.


## Feedback & Contributions

* Found a bug? Got a great feature idea? Post it to the [issue tracker](https://github.com/zeropingheroes/lanager/issues)!
* Want to contribute?
	* [Fork the project](https://github.com/zeropingheroes/lanager/fork) and add the features you want to see
	* Work on new features / bug fixes in the [issue tracker](https://github.com/zeropingheroes/lanager/issues)
	* Or if you're really hardcore, request commit access

If you want to support the project in a non-technical way, we'd love it if you donated to us:

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=zeropingheroes&url=https%3A%2F%2Fgithub.com%2Fzeropingheroes%2Flanager)<commit_msg>Added full & tested install steps for Ubuntu 14.04<commit_after>LANager
=======

LANager is a web application designed to make [LAN Parties](https://en.wikipedia.org/wiki/Lan_party)
more enjoyable for attendees and organisers alike.

## Goals & Features

* Enhance participation
	* [Games in progress](http://zeropingheroes.co.uk/wp-content/gallery/lanager/games.png) updated every minute from Steam
	* [Servers being played on](http://zeropingheroes.co.uk/wp-content/gallery/lanager/servers.png) with join links, again from Steam
	* [Events](http://zeropingheroes.co.uk/wp-content/gallery/lanager/lanager-timetable.png) system optionally allowing users to [join events](http://zeropingheroes.co.uk/wp-content/gallery/lanager/event-signups.png)
	* [Shouts](http://zeropingheroes.co.uk/wp-content/gallery/lanager/shouts.png) allowing advertising of games
	* [Files](http://zeropingheroes.co.uk/wp-content/gallery/lanager-old/files.png) that may be required to join in *
* Boost social interaction
	* [Attendee profiles](http://zeropingheroes.co.uk/wp-content/gallery/lanager/profile.png) with links to add or message on Steam
	* [List of attendees](http://zeropingheroes.co.uk/wp-content/gallery/lanager/people.png) with their current status
* Broadcast information
	* [Info pages](http://zeropingheroes.co.uk/wp-content/gallery/lanager/info_0.png) so that everyone can find out about the venue, food or tournament rules  
	* [Links](http://zeropingheroes.co.uk/wp-content/gallery/lanager/links.png) to other sites e.g. game stats, organiser's website 
* Allow attendee feedback
	* [Request music & videos](http://zeropingheroes.co.uk/wp-content/gallery/lanager/playlist.png) for play-out on a big screen
	* [Watch & listen](http://zeropingheroes.co.uk/wp-content/gallery/lanager-old/playlist_screen.png) to requested music & videos
* API access
	* Allow user status, game and server information for non-steam applications to be used *
	* Make data available for events, users, info pages, shouts, videos etc *
	* Generally avoid tying the project to the Steam platform *
* Much more
	* Check the [issue tracker](https://github.com/zeropingheroes/lanager-core/issues?labels=enhancement&milestone=&page=1&state=open) for more planned enhancements

\* *Planned but not yet implemented*

## Requirements
* Web server - *Apache 2.4.x recommended*
* Database server - *MySQL 5.5.x recommended*
* Git 1.9.x
* PHP 5.5.x
* Composer 1.x
* A [Steam Account](https://store.steampowered.com/join/)
* An Internet connection
* Shell access to the server - **basic web hosting alone will not work!** 

## Installation on [Ubuntu Server 14.04](http://www.ubuntu.com/download/server)

*Advanced users will be able to deploy LANager to Windows and OS X, though this is not recommended.*

1. Install the project's packaged dependencies:

	`sudo apt-get install git php5-common php5-cli php5-mcrypt php5-curl php5-mysql libapache2-mod-php5 mysql-server apache2`

2. Enable Apache and PHP modules:

	`sudo a2enmod rewrite`

	`sudo php5enmod mcrypt curl`

3. Install Composer:

	`sudo curl -sS https://getcomposer.org/installer | php`

	`sudo mv composer.phar /usr/bin/composer`

4. Clone the project:

	`sudo git clone https://github.com/zeropingheroes/lanager.git`

5. Move the project to Apache's web root directory:

	`sudo mv lanager /var/www/lanager`

6. Install the project's dependencies:

	`cd /var/www/lanager`
	
	`sudo composer update`

7. Configure Apache to use the LANager's public directory as the web root:

	1. Edit the default site configuration:

		`sudo nano /etc/apache2/sites-enabled/000-default.conf`

	2. Change the DocumentRoot line to:
	
		`DocumentRoot /var/www/lanager/public`

	3. Add the following lines to allow .htaccess files to set options in this directory (for [pretty URLs](http://laravel.com/docs/4.2/installation#pretty-urls):
	
		```
		<Directory /var/www/lanager/public>
			AllowOverride All
		</Directory>
		```

8. Allow full read and write access on the app's storage directory:

	`sudo chmod -R 777 /var/www/lanager/app/storage`
	
9. Create a MySQL user and database and grant the required privileges:
    
	1. Run `mysql -u root -p`
	2. Type your MySQL root user password you chose during MySQL package installation
	3. Once you are at the `mysql>` prompt, run each of the following in turn:
		1. `CREATE DATABASE lanager;`
		2. `CREATE USER 'lanager'@'localhost' IDENTIFIED BY 'type a password here';`
		3. `GRANT ALL PRIVILEGES ON lanager.* TO 'lanager'@'localhost';`
		4. `FLUSH PRIVILEGES;`
		5. `quit;`

10. Set the database password in the database config file:

	1. `sudo nano /var/www/lanager/app/config/database.php`
	2. Change the `password` line to your chosen password in the previous step

11. Set your [Steam Web API key](http://steamcommunity.com/dev/apikey) in the steam config file:

	`sudo nano /var/www/lanager/app/config/lanager/steam.php`

12. Run the LANager installation command:

	`cd /var/www/lanager`
	
	`sudo php artisan lanager:install`

13. Schedule the LANager Steam state import command to run at 1 minute intervals:

	1. Make the script file executable
		
		`sudo chmod +x /var/www/lanager/SteamImportUserStates.sh`
	
	2. Add the script as a cron job
		
		1. Run `crontab -e`
		2. Add the following to the end of the file:
		`*/1 * * * * /var/www/lanager/SteamImportUserStates.sh >> /dev/null 2>&1`

## Usage

Once you have completed the installation, you can sign in via Steam. The first user to sign in will be granted the "Super Admin" role, allowing you to assign roles to other users who sign in.

Look through the configuration files inside `/var/www/lanager/app/config/lanager/` which will allow you to tailor your installation to your event.  

*This section will be expanded upon as features are solidified.*

## Updating

To update to the latest version,  directory simply run the following commands:

1. Back up your config files:

	`sudo cp /var/www/lanager/app/config ~/lanager-config-backup`

2. Back up your database data:

	`mysqldump lanager -u lanager -p --result-file=lanager.sql`

3. Move to the root of the project directory:

	`cd /var/www/lanager`

4. Reset all project files to their defaults:

	`sudo git reset --hard`

5. Empty the database data and structure:

	1. `mysql -u root -p`
	2. `DROP DATABASE lanager;`
	3. `CREATE DATABASE lanager;`
	4. `quit;`

5. Get the latest version from the project repository:
	
	`sudo git pull origin`

6. Install / update dependencies:

	`sudo composer update`

7. Manually set your config options from the backed up files (see install steps 10 and 11)

8. Re-allow full read and write access on the app's storage directory:

	`sudo chmod -R 777 /var/www/lanager/app/storage`

8. Re-run the installation command:
	
	`sudo php artisan lanager:install`

Be warned that config file and database structure may have changed between versions so pay attention when copying data from backups from old versions.


## Feedback & Contributions

* Found a bug? Got a great feature idea? Post it to the [issue tracker](https://github.com/zeropingheroes/lanager/issues)!
* Want to contribute?
	* [Fork the project](https://github.com/zeropingheroes/lanager/fork) and add the features you want to see
	* Work on new features / bug fixes in the [issue tracker](https://github.com/zeropingheroes/lanager/issues)
	* Or if you're really hardcore, request commit access

If you want to support the project in a non-technical way, we'd love it if you donated to us:

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=zeropingheroes&url=https%3A%2F%2Fgithub.com%2Fzeropingheroes%2Flanager)
{'fraction_non_alphanumeric': 0.10521607486925406, 'fraction_numerical': 0.01211120286264795, 'mean_word_length': 4.1977825464949925, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 17, 'lorem ipsum': 0, 'www.': 15, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4835591', 'n_tokens_mistral': 4785, 'n_tokens_neox': 4461, 'n_words': 1623}