How to make this multiplayer flash game publicly available? [closed]

Solution 1:

Right. You'll need to get a VPS, or at least an Amazon EC2 cloud instance to run this on. I'm 99.99% certain that you can't use the free package at 000webhost to do this. They're a pure webhost, and you need somewhere you can configure and install Java, and the SmartFox server.

So.. Go to aws.amazon.com and sign up for a free account.

You'll need to provide them with a credit/debit card number, but they won't charge you as long as you keep within the free tier resource limits.

Once you've got an account, go here and start an EC2 instance. There's a metric boatload of AWS 101 tutorials on the internet if you do some googling about.

This all assumes you know a bit about linux, but if you create your first instance using Ubuntu Linux 12.04 64-bit server, it'll make everything a bit easier!

When you click to create an instance you get this chooser: enter image description here

Select "Classic Wizard" and this AMI to boot.

Select the default options for this instance..

And the defaults on the next page too.

Select the default storage options enter image description here

And then name it. enter image description here

You now need to create a SSH key, and name that too. When you click "Download Keypair" your browser will save the private key. Keep this safe, because if you lose it, you've effectively lost the master key to your new server. enter image description here

Now we need to create a security group. This is the firewall of Amazon EC2. Create a security Group

Add inbound rules for SSH, HTTP and HTTPS. This'll be enough for now.

Adding Rulez.

Review the selections you've made. Review it.

Hurrah! It should now be booting.. booting time

Time to get into it. This is the control panel.

Control Panel

Select your new server instance, and right click it and you get this menu.

Then click connect

Then click Connect.

To access your instance:
Open an SSH client.
Locate your private key file (SmartFox.pem). The wizard automatically detects the key you used to launch the instance.
Your key file must not be publicly viewable for SSH to work. Use this command if needed: 
chmod 400 SmartFox.pem
Connect to your instance using its Public DNS. [ec2-xx-xx-xx-xx.compute-1.amazonaws.com].
Example
Enter the following command line:
ssh -i SmartFox.pem [email protected]

Which is nearly right, except as it's an Ubuntu instance, you want to

ssh -i SmartFox.pem [email protected]

So, let's do that.

ubuntu@ip-10-243-117-245:~$ 

And we're in. Magic!

Gonna need the SmartFox installer next..

Download with wget, then tar xzvf and extract it.

cd ~
wget http://www.smartfoxserver.com/downloads/sfs2x/SFS2X_unix_2_0_1_64.tar.gz 

tar xzvf SFS2X_unix_2_0_1_64.tar.gz 

ls -lah
total 98544
drwxr-xr-x   4 tom  staff   136B 19 Feb 22:51 .
drwxr-xr-x  79 tom  staff   2.6K 19 Feb 22:41 ..
-rw-r--r--   1 tom  staff    48M 21 May  2012 SFS2X_unix_2_0_1_64.tar.gz
drwxr-xr-x   9 tom  staff   306B 13 Feb  2012 SmartFoxServer2X

⚡ SmartFoxServer2X ls -lah
total 160
drwxr-xr-x   9 tom  staff   306B 13 Feb  2012 .
drwxr-xr-x   4 tom  staff   136B 19 Feb 22:51 ..
drwxr-xr-x  15 tom  staff   510B 13 Feb  2012 .install4j
drwxr-xr-x   6 tom  staff   204B 13 Feb  2012 Client
-rwxr-xr-x   1 tom  staff    71K 13 Feb  2012 LicenseAgreement.pdf
-rwxr-xr-x   1 tom  staff   5.7K 13 Feb  2012 RELEASE-NOTES.html
drwxr-xr-x  13 tom  staff   442B 13 Feb  2012 SFS2X
drwxr-xr-x   8 tom  staff   272B 13 Feb  2012 jre
drwxr-xr-x   9 tom  staff   306B 13 Feb  2012 third-party-licenses

So, you can go ahead and start the damn thing now.

ubuntu@ip-10-243-117-245:~/SmartFoxServer2X/SFS2X$ ./sfs2x-service start

or with a full path, start it by running

/home/ubuntu/SmartFoxServer2X/SFS2X/sfs2x-service start

and stop it with:

/home/ubuntu/SmartFoxServer2X/SFS2X/sfs2x-service stop

You can perform the following commands on that sfs2x-service: {start|stop|status|restart|force-reload}

Interestingly enough, it looks like SmartFox by default, needs port 8080 opening up on the AWS Security Group firewall.

ubuntu@ip-10-243-117-245:~/SmartFoxServer2X/SFS2X$ sudo netstat -anp |grep java
tcp6       0      0 127.0.0.1:9933          :::*                    LISTEN      9142/java       
tcp6       0      0 :::8080                 :::*                    LISTEN      9142/java       
udp6       0      0 127.0.0.1:9933          :::*                                9142/java       

Luckily, that's really easy.

On the sidebar of the control panel, there's a Security Groups link. enter image description here

Edit it, add a custom TCP rule and allow port 8080 to 0.0.0.0/0

enter image description here

Add the rule, and apply the changes.

You should now be able to reach your SmartFox game server on the DNS name given to you by Amazon EC2 in the control panel. It's the same bit you SSH'd to earlier.

That's all folks!