-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathserver.html
140 lines (117 loc) · 5.84 KB
/
server.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Playtomic: Setting up your server</title>
<meta name="description" content="Leaderboards and more for iOS, Android, Unity3d, html5, actionscript and more.">
<link href='css/bootstrap/bootstrap.min.css' rel='stylesheet' type='text/css'>
<link href='css/custom.css' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800' rel='stylesheet' type='text/css'>
<link rel="icon" href="assets/favicon.ico" type="image/icon" />
</head>
<body>
<div id="sponsor">
<div class="container">
Need support you can't find on Stackoverflow or programming communities you use? I'm busy but you can <a href="mailto:benlowry@outlook.com">contact me</a>!
</div>
</div>
<header>
<div class="container">
<a href="http://playtomic.org/" class="logo"><img src="assets/playtomic.png" alt="Playtomic" title="Playtomic" /></a>
<ul>
<li><a href="/server.html">Server setup</a></li>
<li><a href="/games.html">Game setup</a></li>
<li><a href="/apis.html">API documentation</a></li>
<li class="follow">
<a href="https://github.com/playtomic" target="_blank" class="github-follow-button">
<img src="/assets/github.png" alt=""/>
Github
</a>
</li>
<li class="follow">
<a href="https://twitter.com/playtomic" target="_blank" class="github-follow-button">
<img src="/assets/twitter.png" alt=""/>
Twitter
</a>
</li>
</ul>
</div>
</header>
<div id="content2">
<div class="container">
<div class="row">
<div class="span12">
<div class="section">
<h1>Deploy to Heroku</h1>
<p>Just click this button to deploy the software to Heroku for you automatically on their free tier webhosting with the free tier <a href='http://mongolab.com/'>MongoLab</a> MongoDB database.</p>
<p>You will have an opportunity to create your own Heroku account during the deployment.</p>
<p><a href='https://heroku.com/deploy?template=https://github.com/playtomic/apiserver/tree/master'><img src='https://www.herokucdn.com/deploy/button.png' alt='Deploy to Heroku' /></a></p>
</div>
<div class="section">
<h2>Manual setup</h2>
<p>If you want to set the software up yourself on your own hosting you will need <a href='http://nodejs.org/'>NodeJS</a> and <a href='http://mongodb.org'>MongoDB</a>
which can run on any conventional web hosting including <a href=' https://www.digitalocean.com/?refcode=2fc166549414'>Digital Ocean</a> (referral link), <a href='http://aws.amazon.com/'>Amazon Web Services</a> and <a href='http://azure.microsoft.com/'>Microsoft Azure</a>.</p>
</div>
<div class="section">
<h2>Manual setup on Heroku</h2>
<p>This is less necessary now that they have automated deployment from git repositories.</p>
<h3>The server</h3>
<ol>
<li>Create an account at <a href="http://heroku.com/">Heroku</a>.
They have a <a href="https://devcenter.heroku.com/articles/quickstart">great quickstart guide here</a>.</li>
<li>Create an application on your computer for Heroku and download the api server source
from <a href="http://github.com/playtomic/apiserver">Github</a>.</li>
<li><p>In your Compose dashboard copy the "URI" from the "Admin" tab and put your user credentials in it,
and then in your Heroku application:</p>
<pre>heroku config:set playtomic=mongodb://the_uri_you_copied</pre>
</li>
<li><p>Upload the application to Heroku via the command line:</p>
<pre>git add .
git commit -m "Uploading server"
git push heroku master</pre>
</li>
<li><p>Find your application URL via the command line:</p>
<pre>heroku apps:info</pre>
</li>
</ol>
<h3>The database</h3>
<ol>
<li><p>Create a database in your application via the command line:</p>
<pre>heroku addons:add mongolab</pre>
<p></p>The free 'sandbox' one will be enough to get started and for small games.</p></li>
</ol>
<h2>Scaling</h2>
<p>This toolkit is designed to handle more capacity based on the resources you assign it on Heroku.
Each 'dyno' or thread or equivalent for your hosting maintains its own caching and state that is
periodically synced against your database or expired.</p>
<p>Heroku can be automatically scaled using <a href="http://hirefire.io/">HireFire.io</a> to create and terminate 'dynos' as your load requires.</p>
<p>Your Compose database can be manually upgraded at any time through their website.</p>
<h2>Recommended deployment</h2>
<ul>
<li>2+ dynos at Heroku because inactive single-dyno applications hibernate</li>
<li>Use your own domain in case you ever move hosting</li>
<li>SSL to keep your player's activities private</li>
<li>Any paid database plan at <a href="http://compose.io/">Compose</a> or <a href="http://mongolab.com/">MongoLab</a> with <a href="http://aws.amazon.com/s3">Amazon S3</a> backups</li>
<li>HireFire configured to add a few more dynos when necessary</li>
<li><a href="http://pingdom.com/">Pingdom</a> for uptime monitoring</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="container">
© 2013 Ben Lowry. Server and client software are released under the <a href="http://opensource.org/licenses/MIT">MIT license</a>.
</div>
</footer>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40077834-4', 'playtomic.org');
ga('send', 'pageview');
</script>
</body>
</html>