Skip to content

Instantly share code, notes, and snippets.

@stasm
Last active December 17, 2021 18:20
Show Gist options
  • Save stasm/97a5b56587fcd5850cd14fe6f91fe7c8 to your computer and use it in GitHub Desktop.
Save stasm/97a5b56587fcd5850cd14fe6f91fe7c8 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 pontoon-intro
    
  • 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
    
  • commit changes to the container and overwrite the "pontoon" image:

    docker commit 23f7631a0e0a pontoon
    

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
@michelv
Copy link

michelv commented Jul 12, 2016

Before the pip install command for requirements, please add pip install --upgrade pip. (It wouldn't work here otherwise.)

@amuntner
Copy link

amuntner commented Jan 9, 2017

Confirming michelv's report.

after WORKDIR /srv/pontoon
RUN pip install --upgrade pip

After installing the requirements, had errors:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

(on mac osx host)

Otherwise just confirming that the instructions worked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment