Migrations make us crazy!

Our Open Event team is not small, so problems with migrations occur very often. I’d like to describe how to solve these common problems and avoid Contributors frustration. Because more of us didn’t know how to solve this problems at the beginning so we wasted a lot of time to find a source of problem.

The most common mistake is that we forget run migration on Heroku. Developer is sometimes surprised because something works for him but he forgets to run migration on server. These small mistakes lead to huge problems and at that time our app throws a lots of bugs related to database. We can often see “Internal server error”.Screen Shot 2016-06-17 at 22.55.25.png So if developer changes table he has to run migration!

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python manage.py db migrate

But above command Quite often doesn’t solve our problem, because We face other problems while updating DB for example

alembic.util.exc.CommandError: Multiple head revisions are present for given argument ‘head’; please specify a specific target revision, ‘<branchname>@head’ to narrow to a specific head, or ‘heads’ for all heads

this problem is caused by two developers which push code to Github with migrations without merging two heads to achieve one head.

So to solve this problem you only have to know ids of two heads

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python manage.py db heads

e38935822969 (head)
f55fde3d62b1 (head)

Then you have to merge it

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python manage.py db merge e38935822969 f55fde3d62b1

Generating /vagrant/migrations/versions/ecb671d1eb4b_.py … done

Upgrade DB

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python manage.py db upgrade

INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.runtime.migration] Running upgrade 00ea66754d06 -> d84f976530e1, empty message
INFO [alembic.runtime.migration] Running upgrade d84f976530e1 -> 1b3e4f5f56bd, empty message
INFO [alembic.runtime.migration] Running upgrade 1b3e4f5f56bd -> e38935822969, empty message
INFO [alembic.runtime.migration] Running upgrade e38935822969, f55fde3d62b1 -> ecb671d1eb4b, empty message

And finally run migrations

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python manage.py db migrate
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.ddl.postgresql] Detected sequence named ‘role_id_seq’ as owned by integer column ‘role(id)’, assuming SERIAL and omitting
INFO [alembic.ddl.postgresql] Detected sequence named ‘microlocation_id_seq’ as owned by integer column ‘microlocation(id)’, assuming SERIAL and omitting….

Open Event Apk generator

So we made this apk generator currently hosted on a server (http://192.241.232.231) which let’s you generate an android app for your event in 10 minutes out of which the server takes about 8 minutes to build 😛 . So, essentially you just have to spare 2 minutes and just enter 3 things(email, Desired app’s name and Api link). Isn’t this cool?

So how exactly do we do this?

At the backend, we are running a python scripts with some shell scripts where the python script is basically creating directories, interacting with our firebase database to get the data entered by a user. So we made these scripts to first of all to clone the open event android repo, then customise and change the code in the repo according to the parameters entered by the organiser earlier(shown in the image).

Screen Shot 2016-06-14 at 12.13.12 AM
Generator Website

After the code has been changed by the scripts to customise the app according to the event the app will be used for, we move on to the script to build the apk, where we build and sign the apk in release mode using signing configs and release keys from the server because we don’t the organiser to generate keys and store it on the server to avoid the hassle and also the privacy concerns involving the keys. So this is when the apk is generated on the server. Now you have questions like the apk is generated but how do I get it? Do I have to wait on the same page for 10 minutes while the apk is being sent? The answer is no and yes. What I mean by this is that you can wait to download the apk if you want but we’ll anyways send it to your email you specified on the apk generator website. This is the sample Email we got when we were testing the system

Screen Shot 2016-06-14 at 12.08.59 AM.png

So it’s an end to end complete solution from which you can easily get an android app for your event in just 2 minutes. Would love to hear feedback and reviews. Please feel free to contact me @ manan13056@iiitd.ac.in or on social media’s(Twitter, Facebook). Adios!

P.S. : Here is the link to the scripts we’re using.

FOSSASIA Summit 2015 Call for Speakers and Projects

FOSSASIA is the leading Free and Open Source technology organization in Asia organizing the annual FOSSASIA OpenTechSummit for developers, startups, and contributors. In 2015 the event takes place from March 13-15 for the first time in Singapore. Talks, workshops and projects at FOSSASIA range from Open Hardware, to design, Libre Graphics, Maker projects and Open Source Software.

For our 2015 feature event we are looking for speakers that share our passion about code and community. We are interested in topics including:

  • Big data and Open data

  • Javascript, Mobile and Mozilla Open Web

  • Geolocation software, maps and mesh ups

  • Lightweight technologies

  • Maker projects, 3D technologies

  • Open design software, open manufacturing, wearables

  • Cloud solutions

  • Dev-Ops

Participants from Asia and the world are expected to join a three day event. FOSSASIA was established in 2009. Previous events took place in Cambodia and Vietnam.

We are looking forward to your proposals. Submission deadline is 23rd December 2014.

Website

FOSSASIA Community: http://fossasia.org

Event Site: http://2015.fossasia.org

Proposals

Please submit your talk and workshop proposals or projects at site at http://2015.fossasia.org/speaker-registration/

Deadline

Submission deadline is: December 23, 2014.

Speakers and Projects will be accepted until January 5, 2015.

UNESCO Youth Mobile Workshop in Paris with FOSSASIA

The 1st YouthMobile Experts Meeting took place at the UNESCO headquarters on 19th and 20th March 2014 with participation of FOSSASIA. UNESCO has conducted a global search for the best, existing mobile applications training initiatives with openly-licensed training materials, and invited a selected group of training providers and app development tools makers.

Objectives of the Meeting:
1. Facilitate the sharing of best-practices between the training providers; and
2. Further select the best providers to enter into partnerships for up-scaling and integration into teaching and learning environments.

I had the chance to meet David Ascher and Geoffrey MacDougall from Mozilla and Bobby Richter the developer of Mozilla Appmaker. Andrew F. Mckinney is the manager and developer of MIT App Inventor.

The UNESCO seeks to extensively promote very high-quality, multi-lingual, comprehensive training materials for developing mobile apps. Openly-licensed, the training materials identified will allow for adaptations including translation, localization, and innovations. The YouthMobile experts meeting is part of UNESCO’s contribution to the 2014 celebrations for Open Education Week.

 

Organisations and Presentations

 mlab m:Lab East Africa / eMobilis Kenya Presentation   |      Video
 nairobidevschool-alpha Nairobi Dev School Kenya Presentation
 mash-logo_85h The MASH Project India Presentation
 fossasia_logo_85h FOSSASIA Vietnam Presentation
 Technovation Technovation USA Presentation
 AppsForGood Apps For Good England Presentation
 esprit Esprit Tunisia Presentation
alldevcamp-logo-alpha AllDevCamp Cote d’Ivoire Presentation
appmaker_wordmark_black Mozilla / Appmaker USA Presentation
 orange Orange France Presentation
 appinventor MIT App Inventor Project USA Presentation
 fossfa-logo_85h FOSSFA  France Presentation
 intel Intel Software Academic Program France Presentation
 
UNESCO-logo

UNESCO guest speaker    Irmgarda Kasinskaite

UNESCO guest speaker    Maria Kypriotou

France Presentation

 

Links

UNESCO Youth Mobile Program http://en.unesco.org/youthmobile

Youth Mobile http://www.youthmobile.org

FOSSASIA 2014 Phnom Penh

FOSSASIA 2014 in Phnom Penh has been an amazing experience.

We had 3 Days of Pure Knowledge Sharing, 71 International Speakers, 15 Presenters from Cambodia, 121 Talks, Workshops and Panels, 8 tracks per day, Hands-on Labs and Hacking practice for everyone.

Thank you to everyone who contributed to the event, the organization team, Norton University and our sponsors!

Participants at FOSSASIA 2014

 

Links

Event Site: http://2014.fossasia.org