I am trying to get the build number available in the php instance. I will use it as a type of "cache-buster" for the static assets (css, js). Is there any way to get it at run time? If not, is there a way to get it at build time in the postinstall script?
Is there any way to get the build number in the environment or at build-time for a php instance?
67 Views Asked by Dmitry Grekov At
1
There are 1 best solutions below
Related Questions in DOTCLOUD
- Can Zookeeper run on dotcloud
- Can multiple meteor application server instances work behind Hipache reverse proxy?
- SSL Error: CERT_UNTRUSTED on dotCloud
- Dotcloud uWSGI Error
- Ruby on Rails - Having issues trying to connect to a mysql2 database
- dotcloud supervisord twistd exiting early
- dotcloud supervisord.conf file environment specification
- Is there any way to get the build number in the environment or at build-time for a php instance?
- When I add a custom domain, can I still access the old appname-xyzabc.dotcloud.com address?
- How to get the UUID for a dotCloud application?
- Dotcloud supervisord shows error but process is running
- celery failing on dotcloud deployment with IO Error
- Two WWW in dotcloud.yml
- 'npm install websocket' dying on push
- django on dotcloud tutorial: 404 admin not found
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I see a couple of ways you could do this.
/home/dotcloud/the code directory is a symlink to the build version, so for example my code directory points togit-16ae997. In yourpostinstallscript if you get the name of that directory and store it in a temp file, env variable, or maybe inject it into one of your config scripts, you could reference it from your program.Putting this in your
postinstallscript will add theBUILD_VERSIONvariable to your.profileand be available to you from$BUILD_VERSIONin a shell, or other languages. You might need to re-source the.profileafter you make the change to be sure it gets set.With PHP you should be able to get it at runtime with the following variable.
Another approach I have used myself on other projects is to create .version file in the postinstall that just includes the timestamp of the build, and reference that file for the build_version and use it as your cache-buster. The problem with this approach is because it is created at
postinstallif you scale above 1 instance, you will most likely end up with different timestamps for each instance, and I'm guessing this isn't what you want.$ date '+%s' > /home/dotcloud/.version
I would stick with #1 since it works when you scale, and it is more strait forward.
Hope that helps.