Google Apps Engine Tips

Rollback

If an update for GAE (Google App Engine) doesn’t complete it will cause an error (similar to : Another transaction by user xxxx  is already in progress for this app and major version. That user can undo the transaction with appcfg.py’s “rollback” command.) and not allow you to upload new updates. The rollback can de done with a batch file. A faster solution to fix this problem is incrementing the version number in the app.yaml file and activating the new version in the online console. The same error arise if you want to delete an a app with failed update. The only solution in this case is to do the rollback.

Django : high-level Python Web framework

Django was designed to make common Web-development tasks fast and easy. Django adheres to the DRY (Don’t repeat yourself) principle.

Django comes with an object-relational mapper in which you describe your database layout in Python code. Other useful features are a caching framework that integrates with memcached or other backends and a syndication framework that makes creating RSS and Atom feeds as easy as writing a small Python class.

Django has a rich documentation and great tutorials. An active community gives answers to common questions and hints to solve problems.

The Google App Engine provides a Python runtime environment including Django as a third-party library. I started yesterday evening to host a first Facebook application, designed with Python and Django,  on the Google App Server.

Django was originally developed at World Online, the Web department of a newspaper in Lawrence, Kansas, USA. Django is now run by an international team of volunteers.

The main elements of the Django Template Language are :

  • variables :  {{section.title}}   the content is replaced by the title attribute of the section object
  • filters : {{name|ower}}   the content is replaced by the lowercase string of the name; there are about 30 built-in filters; custom template filters can be created
  • tags :  {% doit %}  tags are more versatile than variables;  tags can be used for loops, conditions, …; there are about 24 built-in tags; custom template tags can be created
  • comments :  {#my comment#}  only for single-line comments
  • decorators : @my_decorator   – a decorator is a function that wraps the decorated function  in yet another function, allowing you to run code both before and after the main function
  • template inheritance : {%block identifier%} …….. {%endblock%}   the content of the block named identifier in the base template can be overridden by the content specified in child templates

Domain name system (DNS) & management

Last Update : March 15, 2013

The Domain Name System (DNS) associates various information with domain names; it serves as the “phone book” for the Internet by translating human-readable computer hostnames into IP addresses. A DNS also stores other information such as the list of mail servers that accept email for a given domain. By providing a worldwide keyword-based redirection service, the Domain Name System is an essential component of the Internet.
The right to use a domain name is delegated by domain name registrars which are accredited by the Internet Corporation for Assigned Names and Numbers (ICANN), the organization charged with overseeing the name and number systems of the Internet. In addition to ICANN, each top-level domain (TLD) is maintained and serviced technically by a sponsoring organization, the TLD Registry.

DNS records or Zone files are used for mapping URLs to IPs. Located on servers called the DNS servers, these records are typically the connection of a website with the outside world. Requests for a website are forwarded to the DNS servers and then get pointed to the WebServers that serve the website or to Email servers that handle the incoming email.

DNS servers communicate with each other using private network protocols. All DNS servers are organized in a hierarchy. At the top level of the hierarchy, so-called root servers store the complete database of Internet domain names and their corresponding IP addresses. The Internet employs 13 root servers, named A, B, C and so on up to M, maintained by various independent agencies. When a DNS server receives a request not in its database it automatically passes that request to another DNS server or up to the next higher level in the DNS hierarchy as needed.

The mostly used DNS records in all DNS configurations are the following :

  • A record or adress record : An address record assigns an IP address to a domain or subdomain name. Example : saraproft.com. IN A 69.9.64.11
  • CNAME record : A CNAME record or canonical name record makes one domain name an alias of another. The aliased domain gets all the subdomains and DNS records of the original. Example : stuff.everybox.com CNAME www.everybox.com
  • MX record : An MX record or mail exchange record maps a domain name to a list of mail exchange servers for that domain. Example : mydomain.com. 14400 IN MX 0 mydomain.com.
  • NS record : An NS record or name server record maps a domain name to a list of DNS servers authoritative for that domain. Example : example.com. IN NS ns1.live.secure.com.
  • SOA record : An SOA record or start of authority record specifies the DNS server providing authoritative information about an Internet domain, the email of the domain administrator, the domain serial number, and several timers relating to refreshing the zone. It’s the most essential part of a zone file. It includes TTL, the duration in seconds that the record may be cached by client side programs.
  • TXTrecord : A TXT record allows an administrator to insert arbitrary text into a DNS record. For example, this record is used to implement the Sender Policy Framework specification.

RESTENA is the registration service for Internet domain names under the national top level domain LU in Luxembourg. P&T Luxembourg and Visual Online are also approved as official registrars in Luxembourg. My saraproft.xxx names have been registrated and managed in the past by SpiritDomains. The domain saraproft.lu has been registrated by RESTENA. All the domains have been transferred in the meantine to Visual Online.

DNSstuff.com provides a lot of free and paid tools to configure, monitor and fix problems with a domain or email. Google offers tools to check the MX records and the CNAME records of your own domain. Useful tutorials about setting up Google apps (and to verify ownership of domain) are available at N.E.R.D.logger.com.

Today I deployed with success Google Apps to my domain saraproft.com. Google Apps are smart applications for email, documents, sites and more. The different DNS records for my domain to set up Google Apps are configured as indicated herafter :

A record : the domain saraproft.com points to the IP address of the P&T server hosting my other domains in Luxembourg. This IP address is not relevant for Google Apps.

CNAME : The aliases for www.saraproft.com, mail.saraproft.com, sites.saraproft.com, docs.saraproft.com and calendar.saraproft.com points all to ghs.google.com. It’s important to add a dot at the end of each record parameter. To verify the ownership of the saraproft.com domain, a temporary CNAME record with a secret parameter provided by Google Apps was activated.

MX : The mail domain saraproft.com points to different prioritized mail servers indicated by Google:

  • ASPMX.L.GOOGLE.COM.
  • ALT1.ASPMX.L.GOOGLE.COM.
  • ALT2.ASPMX.L.GOOGLE.COM.
  • ASPMX2.GOOGLEMAIL.COM.
  • ASPMX3.GOOGLEMAIL.COM.
  • ASPMX4.GOOGLEMAIL.COM.
  • ASPMX5.GOOGLEMAIL.COM.

NS : The name server record points to the servers indicated by my registrar SpiritDomains:

  • dns1.spiritdomains.com.
  • dns2.spiritdomains.com.
  • dns3.spiritdomains.com.
  • dns4.spiritdomains.com.

SOA : The SOA record contains the standard data provided by the managed DNS service of SpiritDomains.

TXT : The text record includes the Sender Policy Framework (SPF) with the statement “v=spf1 include:aspmx.googlemail.com ~all” to prevent mails to be considered as spams.