Options for software deployment

DeletedUser

Guest
As you know I made a mapping tool in python 3.1 just to find out if it was feasible to do so (and just for fun ofcourse) . It turned out that the maps were greatly apperciated, and now the next step is making this program available to the community. But what is the best way to do this?

I have been thinking for quite some time about this question and these are my conclusions so far:

1) python 3.1 offline is difficult because I cannot find a way to make an exe file. py2exe doesnt support python 3.1, cxfreeze does not work properly (i get TCL errors when I try).

2) python 3.1 online is difficult because there are no website hosts that support python 3.1.

3) python 2.6 offline would be an option but it requires downgrading from 3.1 to 2.6 and who wants to downgrade? It has the advantage that mxPython can be used instead of Tkinter. I dont know is py2exe or cxfreeze works for making exe from p2.6 scripts.

4) python 2.6 online is possible but not cheap.

5) reprogramming everything to PHP (suggestion of ac04) is possible but for me the fun is using python. Also python is great in using arrays and is relatively fast with loops etc. On the other hand I believe there are more PHP programmers than python programmers.

6) A VPS would be an option but its not cheap. Maybe it can be funded with commercials but I dont know much about that.

So what do you guys think?
 
Last edited by a moderator:

DeletedUser

Guest
I have to take a time someday to try out google app engine, since it's a damn good hosting with python (not sure the version), but it doesn't offer MySQL as far as I can tell, and my script uses it to store the world data.

Anyway, I believe the best choice would be to deploy it as a web application rather then desktop application. Support would be a mess, depending on python and different modules would make it prohibitively complex for the average user, and we would have to provide a lot of support for all the issues that WILL come up.

If it's a web app, regardless of where we decide to host it, we can still keep it open source...so groups could maintain their own instalation, like in an alliance webpage for instance.

Regarding actually hosting it, I have a shared hosting account I could use to host it, with MySQL and SVN, so deploying would be a snap...the only issue would be the python version. It supports 2.5.2, and that's it. I've never actually put anything made in python online tho, so I have no experience with trying to run python things behind Apache.

About the use of Python/PHP, you're absolutely right...writing it in python was the fun part, PHP is...meh. I'd rather write it in Javascript to run in Node.js or in Ruby and host on a free Heroku account lol. I work with PHP every day, if I was to write this in PHP, it would be work, not fun XD
 

DeletedUser

Guest
Oh, and about the version...my script (the one in the project repo) runs on Python 2.5.
 

DeletedUser

Guest
Well for checking out possibilities its a start if you already have an account. I am thinking of using an old PC to set up a webserver to play with, dont want to mess up the one i use to play grepolis with.

I stumbled upon spyce, you might want to look at it as well. And I had a chat with someone from webfaction. As I understand it they allow users of their servers to run software, its not a VPS tho.
 

DeletedUser

Guest
If I got it right, spyce seems like a web dev framework for python. There is a wealth of them to chose from that I know of, to name a few:
Django (the most well known, google apps supports this one)
Flask
Web.py

I got the part about developing, running locally etc., what I haven't learned yet is how to run any of this behind the Apache webserver, which is what my host offers...and the vast majority for that matter.

The thing is, understanding and configuring Apache is one of my worst shortcomings, the whole thing is a monster =X
 

DeletedUser

Guest
And honestly, Apache kinda sucks... the guys behind Grepolis seem to know what they're doing. They're using Nginx for this forum, and Lighttpd for the game itself...which is kinda awesome.

I know it's prohibitively expensive, but I'd love to have access to a VPS =(

EDIT: Just realized I'm sending post after post with criticism and random babbling and not offering any solution...sorry about that. I do have something in mind tho. Here's it:

For starters, we could simply run the script once or twice a day (the shared hosting I mentioned supports Chron Jobs that automate this task) to generate the world map of each world, and make it available online in a simple PHP page (I can write that). It won't be interactive first, but take that as a simple, yet useful test. We'll have something to give to the community quite soon, and from there we can brainstorm how to enhance it.

EDIT 2: As a second step, it would be cool to save one map a day, so we could make interactive visualizations of the server alliances as they evolve. Picture a simple interface with the map, and bellow it, a horizontal slider to control de date being viewed. Sliding from left to right would let you see the evolution of the alliances throughout the server's history.
 
Last edited by a moderator:

DeletedUser

Guest
lol, where are the days one could just make a simple program (like pacman) and have fun with it. Instead of getting old and wise and knowledgeable I find myself spending days on how to do the things I want to do. Its like IT takes control of the world lol. Anyways I must take care not to turn into a grumpy old man...
 

DeletedUser

Guest
I totally feel your pain. I remember writing stuff on Visual Basic (ewww, I know) for fun when I was a kid. That was so empowering...there was no "version control", no "deployment", no "project management", no "frameworks"...just good old magic =P
 

DeletedUser

Guest
Yeah... *sigh*

Anyways to get back to the topic that will interest readers: Thanks to Diggo this page explains some maps that are made for tribal war players. We might get some inspiration from them for grepolis maps.
 

DeletedUser

Guest
As for deployment it would be great if you can get something up and running if only for a "proof of concept". About the slider idea: i'm not sure if i understand how it is supposed to work but keep in mind that animated images are not tolerated in the forum. Dont know if it matters who or what is doing the animation tho :)

I had the idea of animating conquer maps to visualise wars.
 

DeletedUser

Guest
Just received this answer from webfaction support:

Hello <changed to Xarandir>,

> > I have a program written in python 3.1 and pygame that I would like to
> > put on a website so others can use it interactively. Is this possible on
> > your servers? Mary H told me on chat that I could install python 3.1 in
> > my home directory of your server and thus run the scripts, but she told
> > me to check with support for a more authorative answer.
> >
> > Would PSP <http://en.wikipedia.org/wiki/Python_Server_Pages> (Python
> > Server pages) be an alternative approach? Do your servers support this?

Python 3.1 is pre-installed on all of our servers, so you would not need
to install it yourself.

Regarding running your PyGame-based application on the web, I'm not sure
that would be possible. The sound and graphics implementation of PyGame
rely on SDL, and as far as I know there is no plugin available that
would let you run a traditional PyGame game in a browser.

If your game does not rely on the graphics and sound capabilities of
PyGame, for example if it only uses PyGame's event handling, then it
might be possible to hook that into an event-driven web framework, but
I do not know of any such frameworks that will work with Python 3.1.

Regarding Python Server Pages, that's an obsolete technology, and
we don't advocate its use. It's definitely not compatible with Python 3.1.

Regards,

Sean F.
WebFaction Support
--
WebFaction - Smarter web hosting
http://webfaction.com - http://twitter.com/webfaction

> Thank you for your answer.
> > Actually it is not a game, it is a utility to generate maps like these
> > <example map> for a
> > browser game called grepolis. The pygame libraries are used for easy
> > editing of the map.
> > I will try to modify the program to run without the pygame libraries. If
> > thats possible I'll get back to you.
Sounds good. We do offer user level shell access. So if you can make it work, than hosting it on our platform would be no different than running it on any other Linux server. Please let us know if you have any more questions.
 
Last edited by a moderator:

DeletedUser

Guest
As for deployment it would be great if you can get something up and running if only for a "proof of concept". About the slider idea: i'm not sure if i understand how it is supposed to work but keep in mind that animated images are not tolerated in the forum. Dont know if it matters who or what is doing the animation tho :)

I had the idea of animating conquer maps to visualise wars.

Here's the proof of concept:
http://lab.vault7.com/grepolismaps/

Map scaled down via CSS for now, just to fit everything in the screen. And using HTML5 range slider, so it will probably only work on Safari, Google Chrome, and Opera.
(Range sliders look like this:
input-type-range.png
)

I didn't set up the cron job yet, but I did ran the scripts on the server, and it inclues fetching the world data (using world 4 for the demo) and generating the image.

I only had 2 days' worth of world maps, so it only shows 2 maps...play with the slider left-and-right to see the main map image change. Now imagine the same thing, but for a whole month, with one image per day.
 

DeletedUser

Guest
Obvious enhancement to this demo would include:
* Using a javascript-based slider instead of the default HTML5 one, so that people with Firefox or (god forbid) Internet Explorer can use it.
* Writing a decent interface, with the map in real size (it's 1000x1000 pixels)
* Setting up the cron job so it will take daily snapshots

Tomorrow I'll run it again to see how it looks like with one aditional day worth of data :)
 

DeletedUser

Guest
Great :) thats a quick job. The slider bar works in opera. I have a feeling that I can not keep up with it all, but thats ok go ahead and make something beautiful for the community.

I did look at googleapps in the meantime: The advantage is that it is relatively easy to set up (i think) and you have to work with a SDK so everyone uses the same software versions etc. The disadvantage is that it uses a standard python version with no extra libraries, so I dont know if it is possible at all to generate maps using googleapps.
 

DeletedUser

Guest
Hmm...I'm using PIL - Python Imaging Library, which is as far as I can tell the most widely used lib for making graphics.

And luckily, it seems App Engine support it:
http://code.google.com/appengine/docs/python/images/

The tricky part is that I'm using MySQL, and App Engine don't currently support it as far as I can tell. They do provide alternative methods tho, outlined here:
http://code.google.com/appengine/docs/python/datastore/

It will require some non-trivial rewriting in my script tho.

Now, for the web aspect, althought it might seem overwhelming for you, It is really, really simple... check the source code of the demo/proof-of-concept. All I'm doing there with PHP is getting the list of files in the /maps/ directory (where the python script saves them) and printing this as a Javascript array, which you will instantly recognize:
Code:
["2010-10-27.png","2010-10-31.png"]
I wrote this in PHP out of pure convenience...we could just as easily generate a stactic HTML everytime the map script runs.

With that, via Javascript, whenever the user moves the slider, I show the appropriate image. Really quick & dirty implementation =P

If you don't want to mess with html/css/javascript, I'm perfectly fine with taking care of this portion myself.
 

DeletedUser

Guest
Sounds like a good idea. I'm from Mars, I can only concentrate on one thing at a time :) and right now I am curious about the possibilities of google_apps so yeah if you can take care of the dayly map generation that's great. If you feel like you can publish them we can ask ac04 to archive my map threads in each world. No need to have duplicate map.
 

DeletedUser

Guest
Added another day's worth of data:http://lab.vault7.com/grepolismaps/

One thing that is becaming obvious, is that defining colors by the ranking position of each alliance doesn't seem to be the optimal solution in this kind of visualization. As alliances rise or fall in the ranking, they swap collors making it difficult for the user to see a single alliance's evolution.

Maybe we could think of some sort of algorithm to generate colors based on the name or ID of the alliance rather then the position in the ranking.

Thoughts?

edit: I also removed the scaling of the image, so it's 1000x1000 pixels again. The slider is still near the bottom-right corner of the image, depending on your screen resolution you'll have to scroll down to see it.
 
Last edited by a moderator:

DeletedUser

Guest
Google app engine can be ruled out as an option. I played with it, made an account, made a little routine to load player data in the datastore and wanted to test that.

After loading 356 player records of world 1 into the database (i had a loop of 1000 which I thought was nice to start with) the program crashed and I got a warning that my CPU quotum was exceeded. So google app engine is fine for making a guestbook on your site but is not suitable for manipulating loads of data.
 

DeletedUser

Guest
So rev, any news?

I have decided to make an off-line program that collects world data, I have convinced myself that on-line tools are not an option at this moment.

I am using python 2.6 for programming and py2exe to make executables. I now use mxPython for user interface. After every step I make sure I can make a working exe file.
Downloading world data and storing/retrieving it from files works fine, however pygame does not work so I have to use PIL.

Rev, do you know if I can obtain the x-y coordinates of the mouse pointer when hoovering over an image using PIL? Because that was what I planned to use pygame for.
 

DeletedUser

Guest
Hmm getting quiet here...

I hope I can upload a very ugly but working version of the .exe file for offline map making this weekend. Anyone interested in trying this program out?

It allows you to draw a world map with selectable players and selectable alliances in a selectable color. Until now I have fixed URL's so you cant change the world, but I hope I can make the world selectable as well this weekend.
 
Top