Skip to content

Instantly share code, notes, and snippets.

@davidascher
Forked from stasm/.env
Last active February 28, 2017 17:41
Show Gist options
  • Save davidascher/7124cb6e7f52562cdfda472303e19939 to your computer and use it in GitHub Desktop.
Save davidascher/7124cb6e7f52562cdfda472303e19939 to your computer and use it in GitHub Desktop.
Pontoon in Docker
SECRET_KEY=hiphopopotamus
DJANGO_DEV=True
DJANGO_DEBUG=True
DATABASE_URL=postgres://pontoon:pontoon@localhost/pontoon
SESSION_COOKIE_SECURE=False
SITE_URL=http://localhost:8000
FXA_CLIENT_ID=2651b9211a44b7b2
FXA_SECRET_KEY=a3cafccbafe39db54f2723f8a6f804c337e362950f197b5b33050d784129d570
FXA_OAUTH_ENDPOINT=https://oauth-stable.dev.lcip.org/v1
FXA_PROFILE_ENDPOINT=https://stable.dev.lcip.org/profile/v1

Set up Pontoon in a Docker container

The following instructions are based on http://mozilla-pontoon.readthedocs.io/en/latest/dev/install.html.

On your host:

  • clone Pontoon and cd into it; this will be the working directory for the rest of this how-to:

    git clone --recursive https://github.com/mozilla/pontoon.git
    cd pontoon
    
  • copy Dockerfile and .env into pontoon/

  • build the image and call it "pontoon"

    docker build -t pontoon .
    
  • start the container:

    docker run -itp 8000:8000 -v $(pwd):/srv/pontoon pontoon "/bin/bash"
    

Inside of the container:

  • install dependencies:

    pip install --require-hashes -r requirements-dev.txt; npm install
    
  • start PostgreSQL and run migrations:

    service postgresql start
    python manage.py migrate
    python manage.py sync_projects --no-commit 
    
  • create the admin user (make sure you use your Firefox Accounts email address):

    python manage.py createsuperuser
    python manage.py updatefxaprovider
    
  • run Django:

    python manage.py runserver 0.0.0.0:8000
    

Back on the host:

  • navigate to http://localhost:8000

  • get the id of the container:

    docker ps
    

    (find the id that corresponds to the pontoon container)

  • commit changes to the container and overwrite the "pontoon" image:

    docker commit 23f7631a0e0a pontoon # use whatever ID you got above
    

Next time you run the image:

  • host:

    docker run -itp 8000:8000 -v $(pwd):/srv/pontoon pontoon "/bin/bash"
    
  • container:

    service postgresql start && sleep 5 && python manage.py runserver 0.0.0.0:8000
    
FROM ubuntu
RUN apt update
RUN apt install -y sudo git python-pip nodejs-legacy npm postgresql postgresql-server-dev-9.5 libxml2-dev libxslt1-dev python-dev libmemcached-dev
USER postgres
RUN service postgresql start \
&& psql --command "CREATE USER pontoon WITH SUPERUSER PASSWORD 'pontoon';" \
&& createdb --owner=pontoon pontoon
USER root
WORKDIR /srv/pontoon
EXPOSE 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment