Content Skeleton

This Page

Previous topic

Bitbucket Static Pages

Next topic


Apache to bitbucket


Notes on migrating storing static resources (html pages, images, PDF, video) from locally hosted apache to cloud servers from bitbucket and dropbox.


  1. With bitbucket web interface create repository named:

  2. Clone that repo locally:

    delta:~ blyth$ hg clone ssh://
    destination directory:
    no changes found
    updating to branch default
    0 files updated, 0 files merged, 0 files removed, 0 files unresolved
    delta:~ blyth$
  3. add, commit, push static index.html to the root

env notes

Add bb target to ~/env/Makefile that populates ~/ with the Sphinx generated html.

  1. slightly funny doing that out of svn working copy, but have not migrated yet, still testing blyth$ hg commit -m "test Sphinx html with bitbucket static pages " blyth$ blyth$ hg push
pushing to ssh://
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes

Bitbucket Static pages rejig

C2 is again offline, last straw

  1. through bitbucket web interface

    • delete repository named
    • create repository named # make it public this time
  2. in file system:

    delta:~ blyth$ rm -rf    # delete old clone
    delta:~ blyth$ hg clone ssh://   # clone the empty
  3. amend bb target of env/Makefile Sphinx build to create/populate BITBUCKET_HTDOCS/env/notes and build:

    delta:e blyth$ make bb
  4. amend target of env/muon_simulation/presentation/Makefile to create populate BITBUCKET_HTDOCS/env/muon_simulation/presentation and build:

    slides-;slides-scd;make  # OR slides-;slides-make
  5. move original APACHE_HTDOCS/env to env.keep and create symbolic link to allow local apache testing of html and resources without committing+pushing to bitbucket:

    delta:Documents blyth$ sudo ln -s /Users/blyth/
  6. move across the contents of APACHE_HTDOCS/env.keep to the new BITBUCKET_HTDOCS/env excluding the videos

  7. add to the bitbucket repo, mercurial complains about big PDF, so revert and place in Dropbox/Public

    env/muon_simulation/presentation/gpu_optical_photon_simulation.pdf: up to 115 MB of RAM may be required to manage this file (use ‘hg revert env/muon_simulation/presentation/gpu_optical_photon_simulation.pdf’ to cancel the pending addition) blyth$ du -h env/muon_simulation/presentation/gpu_optical_photon_simulation.pdf

    37M env/muon_simulation/presentation/gpu_optical_photon_simulation.pdf

    (adm_env) blyth$ mv env/muon_simulation/presentation/gpu_optical_photon_simulation.pdf ~/Dropbox/Public/

Layout migration rejig

Sphinx derived html, for env at least, are very much notes. Make that explicit and avoid double top “e” and “env” with layout at expense of the path. As all repos share the one

  1. /env/notes Sphinx derived notes
  2. /env/... other resources
  3. /env/muon_simulation/presentation/

Formerly Sphinx and slides building machinery generates html into APACHE_HTDOCS/e and APACHE_HTDOCS/env respectively. Instead of this generate into BITBUCKET_HTDOCS/env/notes and BITBUCKET_HTDOCS/env Then can publish by a Mercurial commit and push.

All bitbucket repos under a username share the same single static pages repo, so having a one to one correspondence to a top level dir named after the repo is the cleanest way.

Whats missing

On cms02, also used bare apache for docs like presentations and images:

find $(apache-htdocs)/env

Need way to reference those from Sphinx pages, and need to avoid the big ones:

delta:env blyth$ du -hs $(apache-htdocs)/env
2.4G    /Library/WebServer/Documents/env

Bitbucket limits

TODO: Investigate Dropbox for longterm holding of binaries

Sphinx downloads

For small numbers of binaries can use Sphinx download with RST source like:

described in the :download:`Chroma whitepaper <chroma.pdf>`.

Not so keen on this,

  1. it results in having multiple copies of the binary that get copied around by the Sphinx build.
  2. Prefer a single resource with a single URL, that never gets copied

existing resource approach and how to map into bitbucket

  1. binaries (images, pdf, videos) served by apache from $APACHE_HTDOCS/env/
  2. Sphinx derived html served from $APACHE_HTDOCS/e/

Keeping big and unchanging binaries separate from small and frequently changing html is a good pattern to continue. Could map this into bitbucket via directory structure in the static pages repo:


But its all one repo anyhow, that is populated by

  1. sphinx build
  2. manual placement of resources

Could in principal create a script to merge the resource and derived html trees ? But that introduces complication and makes it difficult to do clean Sphinx builds.

managing the binaries

Most of the binaries are not huge, only the video is potentially a problem, maybe dropbox for that. But need a way to select only binaries that are actually referred to.

video on dropbox

Right click on video stored in your Public Dropbox folder to get the Public link, include that URL in

Some suggestions to add to /etc/hosts:

resource collection

  1. Extended ~/e/muon_simulation/presentation/ to doctree traverse collecting and resolving the urls of resources used in the document (images, videos, background images).
  2. ~/e/bin/ adding up sizes