Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 7ba020d

Browse files
committed
Merges the Candy dev environment
Comes from candy-chat/vagrant#1. There's no convincing reason for this to be excluded from the main reason. The Vagrant environment makes working on Candy easier (provides an XMPP server for testing, Selenium & PhantomJS for automated tests and a ready-made NodeJS environment for building. This excludes candy-plugins for now. We can figure out how that fits later.
1 parent 97c81c1 commit 7ba020d

8 files changed

+381
-3
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ bower_components
1010
candy.bundle.*
1111
candy.min.*
1212
libs.bundle.*
13-
libs.min.*
13+
libs.min.*
14+
.vagrant

CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ A few hopefully helpful hints to contributing to Candy
2121
#### Using vagrant
2222
1. [Fork](https://help.github.com/articles/fork-a-repo) Candy
2323
2. [Install Vagrant](http://vagrantup.com/)
24-
3. Follow instructions [for Candy Vagrant](https://github.com/candy-chat/vagrant)
25-
4. Change the remote in the `candy` and `candy-plugins` repos: `git remote set-url origin git://github.com/YOURNAME/candy` (or candy-plugins)
24+
3. Run `vagrant up`.
2625
5. Create a branch based on the `dev` branch (`git checkout -B my-awesome-feature`)
2726
6. Run `grunt watch` to automatically run jshint (syntax checker) and the build of `candy.bundle.js` and `candy.min.js` while developing.
2827
7. Make your changes, fix eventual *jshint* errors & push them back to your fork

Vagrantfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
config.vm.box = "ubuntu/trusty64"
9+
config.vm.network :forwarded_port, guest: 80, host: 8080
10+
config.vm.network :forwarded_port, guest: 5280, host: 5280
11+
config.vm.network :forwarded_port, guest: 4444, host: 4444
12+
config.vm.network :private_network, ip: '192.168.88.4'
13+
14+
config.vm.provision :shell, :path => "devbox/provisioning.sh"
15+
16+
config.vm.provider "virtualbox" do |v|
17+
v.name = "candy"
18+
end
19+
end

devbox/index.html

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Candy - Chats are not dead yet</title>
6+
<link rel="shortcut icon" href="candy/res/img/favicon.png" type="image/gif" />
7+
<link rel="stylesheet" type="text/css" href="candy/res/default.css" />
8+
9+
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
10+
<script type="text/javascript" src="candy/libs/libs.min.js"></script>
11+
<script type="text/javascript" src="candy/candy.min.js"></script>
12+
<script type="text/javascript">
13+
$(document).ready(function() {
14+
//Candy.init('/http-bind/', { // uncomment & comment next line if you'd like to use BOSH
15+
Candy.init('ws://localhost:5280/xmpp-websocket/', {
16+
core: {
17+
// only set this to true if developing / debugging errors
18+
debug: true,
19+
// autojoin is a *required* parameter if you don't have a plugin (e.g. roomPanel) for it
20+
// true
21+
// -> fetch info from server (NOTE: does only work with openfire server)
22+
23+
// -> array of rooms to join after connecting
24+
autojoin: ['[email protected]']
25+
},
26+
view: { resources: 'candy/res/' }
27+
});
28+
29+
Candy.Core.connect('localhost');
30+
31+
/**
32+
* Thanks for trying Candy!
33+
*
34+
* If you need more information, please see here:
35+
* - Setup instructions & config params: http://candy-chat.github.io/candy/#setup
36+
* - FAQ & more: https://github.com/candy-chat/candy/wiki
37+
*
38+
* Mailinglist for questions:
39+
* - http://groups.google.com/group/candy-chat
40+
*
41+
* Github issues for bugs:
42+
* - https://github.com/candy-chat/candy/issues
43+
*/
44+
});
45+
</script>
46+
</head>
47+
<body>
48+
<div id="candy"></div>
49+
</body>
50+
</html>

devbox/nginx-default.conf

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
server {
2+
root /usr/share/nginx/html;
3+
index index.html;
4+
5+
charset utf-8;
6+
7+
server_name localhost;
8+
9+
location /http-bind/ {
10+
proxy_pass http://localhost:5280/http-bind/;
11+
proxy_buffering off;
12+
tcp_nodelay on;
13+
}
14+
}

devbox/prosody.cfg.lua

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
-- Prosody Example Configuration File
2+
--
3+
-- Information on configuring Prosody can be found on our
4+
-- website at http://prosody.im/doc/configure
5+
--
6+
-- Tip: You can check that the syntax of this file is correct
7+
-- when you have finished by running: luac -p prosody.cfg.lua
8+
-- If there are any errors, it will let you know what and where
9+
-- they are, otherwise it will keep quiet.
10+
--
11+
-- The only thing left to do is rename this file to remove the .dist ending, and fill in the
12+
-- blanks. Good luck, and happy Jabbering!
13+
14+
15+
---------- Server-wide settings ----------
16+
-- Settings in this section apply to the whole server and are the default settings
17+
-- for any virtual hosts
18+
19+
-- This is a (by default, empty) list of accounts that are admins
20+
-- for the server. Note that you must create the accounts separately
21+
-- (see http://prosody.im/doc/creating_accounts for info)
22+
-- Example: admins = { "[email protected]", "[email protected]" }
23+
admins = { }
24+
25+
-- Enable use of libevent for better performance under high load
26+
-- For more information see: http://prosody.im/doc/libevent
27+
use_libevent = true;
28+
29+
-- This is the list of modules Prosody will load on startup.
30+
-- It looks for mod_modulename.lua in the plugins folder, so make sure that exists too.
31+
-- Documentation on modules can be found at: http://prosody.im/doc/modules
32+
modules_enabled = {
33+
34+
-- Generally required
35+
"roster"; -- Allow users to have a roster. Recommended ;)
36+
"saslauth"; -- Authentication for clients and servers. Recommended if you want to log in.
37+
"tls"; -- Add support for secure TLS on c2s/s2s connections
38+
"dialback"; -- s2s dialback support
39+
"disco"; -- Service discovery
40+
41+
-- Not essential, but recommended
42+
"private"; -- Private XML storage (for room bookmarks, etc.)
43+
--"vcard"; -- Allow users to set vCards
44+
"privacy"; -- Support privacy lists
45+
--"compression"; -- Stream compression
46+
47+
-- Nice to have
48+
--"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
49+
"version"; -- Replies to server version requests
50+
"uptime"; -- Report how long server has been running
51+
"time"; -- Let others know the time here on this server
52+
"ping"; -- Replies to XMPP pings with pongs
53+
--"pep"; -- Enables users to publish their mood, activity, playing music and more
54+
"register"; -- Allow users to register on this server using a client and change passwords
55+
"adhoc"; -- Support for "ad-hoc commands" that can be executed with an XMPP client
56+
57+
-- Admin interfaces
58+
"admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
59+
--"admin_telnet"; -- Opens telnet console interface on localhost port 5582
60+
61+
-- Other specific functionality
62+
"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP"
63+
"websocket"; -- Websocket support
64+
--"httpserver"; -- Serve static files from a directory over HTTP
65+
--"groups"; -- Shared roster support
66+
--"announce"; -- Send announcement to all online users
67+
--"welcome"; -- Welcome users who register accounts
68+
--"watchregistrations"; -- Alert admins of registrations
69+
--"motd"; -- Send a message to users when they log in
70+
-- Debian: do not remove this module, or you lose syslog
71+
-- support
72+
"posix"; -- POSIX functionality, sends server to background, enables syslog, etc.
73+
};
74+
75+
-- These modules are auto-loaded, should you
76+
-- (for some mad reason) want to disable
77+
-- them then uncomment them below
78+
modules_disabled = {
79+
-- "presence"; -- Route user/contact status information
80+
-- "message"; -- Route messages
81+
-- "iq"; -- Route info queries
82+
-- "offline"; -- Store offline messages
83+
};
84+
85+
-- Disable account creation by default, for security
86+
-- For more information see http://prosody.im/doc/creating_accounts
87+
allow_registration = false;
88+
89+
-- Debian:
90+
-- send the server to background.
91+
--
92+
daemonize = true;
93+
94+
-- Debian:
95+
-- Please, don't change this option since /var/run/prosody/
96+
-- is one of the few directories Prosody is allowed to write to
97+
--
98+
pidfile = "/var/run/prosody/prosody.pid";
99+
100+
-- These are the SSL/TLS-related settings. If you don't want
101+
-- to use SSL/TLS, you may comment or remove this
102+
ssl = {
103+
key = "/etc/prosody/certs/localhost.key";
104+
certificate = "/etc/prosody/certs/localhost.crt";
105+
}
106+
107+
-- Only allow encrypted streams? Encryption is already used when
108+
-- available. These options will cause Prosody to deny connections that
109+
-- are not encrypted. Note that some servers do not support s2s
110+
-- encryption or have it disabled, including gmail.com and Google Apps
111+
-- domains.
112+
113+
--c2s_require_encryption = false
114+
--s2s_require_encryption = false
115+
116+
-- Select the authentication backend to use. The 'internal' providers
117+
-- use Prosody's configured data storage to store the authentication data.
118+
-- To allow Prosody to offer secure authentication mechanisms to clients, the
119+
-- default provider stores passwords in plaintext. If you do not trust your
120+
-- server please see http://prosody.im/doc/modules/mod_auth_internal_hashed
121+
-- for information about using the hashed backend.
122+
123+
authentication = "anonymous"
124+
125+
-- Select the storage backend to use. By default Prosody uses flat files
126+
-- in its configured data directory, but it also supports more backends
127+
-- through modules. An "sql" backend is included by default, but requires
128+
-- additional dependencies. See http://prosody.im/doc/storage for more info.
129+
130+
--storage = "sql" -- Default is "internal"
131+
132+
-- For the "sql" backend, you can uncomment *one* of the below to configure:
133+
--sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.
134+
--sql = { driver = "MySQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
135+
--sql = { driver = "PostgreSQL", database = "prosody", username = "prosody", password = "secret", host = "localhost" }
136+
137+
-- Logging configuration
138+
-- For advanced logging see http://prosody.im/doc/logging
139+
--
140+
-- Debian:
141+
-- Logs info and higher to /var/log
142+
-- Logs errors to syslog also
143+
log = {
144+
-- Log files (change 'info' to 'debug' for debug logs):
145+
info = "/var/log/prosody/prosody.log";
146+
error = "/var/log/prosody/prosody.err";
147+
-- Syslog:
148+
{ levels = { "error" }; to = "syslog"; };
149+
}
150+
151+
----------- Virtual hosts -----------
152+
-- You need to add a VirtualHost entry for each domain you wish Prosody to serve.
153+
-- Settings under each VirtualHost entry apply *only* to that host.
154+
155+
-- Setup localhost VirtualHost
156+
VirtualHost "localhost"
157+
158+
------ Components ------
159+
-- You can specify components to add hosts that provide special services,
160+
-- like multi-user conferences, and transports.
161+
-- For more information on components, see http://prosody.im/doc/components
162+
163+
---Set up a MUC (multi-user chat) room server on conference.example.com:
164+
Component "conference.localhost" "muc"
165+
166+
-- Set up a SOCKS5 bytestream proxy for server-proxied file transfers:
167+
--Component "proxy.example.com" "proxy65"
168+
169+
---Set up an external component (default component port is 5347)
170+
--
171+
-- External components allow adding various services, such as gateways/
172+
-- transports to other networks like ICQ, MSN and Yahoo. For more info
173+
-- see: http://prosody.im/doc/components#adding_an_external_component
174+
--
175+
--Component "gateway.example.com"
176+
-- component_secret = "password"
177+
178+
------ Additional config files ------
179+
-- For organizational purposes you may prefer to add VirtualHost and
180+
-- Component definitions in their own config files. This line includes
181+
-- all config files in /etc/prosody/conf.d/
182+
183+
Include "conf.d/*.cfg.lua"

devbox/provisioning.sh

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Vagrant provisioning script
4+
#
5+
# Copyright 2014 Michael Weibel <[email protected]>
6+
# License: MIT
7+
#
8+
9+
#
10+
# Install Prosody XMPP server
11+
#
12+
echo "deb http://packages.prosody.im/debian precise main" > /etc/apt/sources.list.d/prosody.list
13+
wget https://prosody.im/files/prosody-debian-packages.key -O- | sudo apt-key add -
14+
apt-get update
15+
16+
apt-get install -y liblua5.1-bitop prosody lua-event
17+
18+
# Install Websockets module
19+
wget -O /usr/lib/prosody/modules/mod_websocket.lua http://prosody-modules.googlecode.com/hg/mod_websocket/mod_websocket.lua
20+
21+
# Place config
22+
cp /vagrant/devbox/prosody.cfg.lua /etc/prosody/prosody.cfg.lua
23+
24+
/etc/init.d/prosody restart
25+
26+
#
27+
# Install nginx for static file serving
28+
#
29+
apt-get install -y nginx
30+
cp /vagrant/devbox/nginx-default.conf /etc/nginx/sites-available/default
31+
/etc/init.d/nginx restart
32+
33+
ln -fs /vagrant /usr/share/nginx/html/candy
34+
ln -fs /vagrant/devbox/index.html /usr/share/nginx/html/index.html
35+
36+
#
37+
# Candy development dependencies
38+
#
39+
sudo add-apt-repository ppa:chris-lea/node.js
40+
sudo apt-get update
41+
sudo apt-get install -y nodejs
42+
43+
cd /vagrant
44+
npm install -g grunt-cli
45+
npm install
46+
47+
#
48+
# Selenium & PhantomJS for testing
49+
#
50+
apt-get install -y openjdk-7-jre
51+
mkdir /usr/lib/selenium/
52+
cd /usr/lib/selenium/
53+
wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar
54+
mkdir -p /var/log/selenium/
55+
chmod a+w /var/log/selenium/
56+
cp /vagrant/devbox/selenium.init.sh /etc/init.d/selenium
57+
chmod 755 /etc/init.d/selenium
58+
/etc/init.d/selenium start
59+
update-rc.d selenium defaults
60+
apt-get install -y phantomjs

0 commit comments

Comments
 (0)