-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
660 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"sequence": { | ||
"run-ci": ["test-all"], | ||
"test-all": ["test-py"], | ||
"test-py": ["test-py-postgres", "test-py-mariadb", "test-py-sqlite"], | ||
"build-all": ["build-base", "build-dev", "build-dev-mariadb", "build-dev-sqlite"], | ||
}, | ||
"shell": { | ||
"compose": "docker-compose", | ||
"git": "git", | ||
|
||
"run": "docker-compose run --rm dev /home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", | ||
"run-sqlite": "docker-compose run --rm dev-sqlite /home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", | ||
"run-mariadb": "docker-compose run --rm dev-mariadb /home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", | ||
|
||
"build-base": "docker-compose build base", | ||
"build-dev": "docker-compose build dev", | ||
"build-dev-mariadb": "docker-compose build dev-mariadb", | ||
"build-dev-sqlite": "docker-compose build dev-sqlite", | ||
|
||
"db": "makey run db", | ||
"pootle": "makey run pootle", | ||
"shell": "makey run shell", | ||
"runserver": "docker-compose run --service-ports --rm dev /home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", | ||
|
||
"db-sqlite": "makey run-sqlite db", | ||
"pootle-sqlite": "makey run-sqlite pootle", | ||
"shell-sqlite": "makey run-sqlite shell", | ||
"runserver-sqlite": "docker-compose run --service-ports --rm dev-sqlite /home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", | ||
|
||
"db-mariadb": "makey run-mariadb db", | ||
"pootle-mariadb": "makey run-mariadb pootle", | ||
"shell-mariadb": "makey run-mariadb shell", | ||
"runserver-mariadb": "docker-compose run --service-ports --rm dev-mariadb /home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", | ||
|
||
"test-py-postgres": "makey run bash py.test -vv", | ||
"test-py-mariadb": "makey run-mariadb bash py.test -vv", | ||
"test-py-sqlite": "makey-sqlite run bash py.test -vv" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# docker-compose for Pootle development. | ||
# | ||
# Note: Requires docker-compose 1.10+. | ||
version: "2" | ||
services: | ||
# Pootle base image | ||
# This image handles user creation and permissions, so that code can be | ||
# shared from your local folder into the docker container. | ||
base: | ||
build: | ||
context: ./docker/base | ||
image: local/pootle:base | ||
|
||
# Dev app (default: postgres) | ||
dev: | ||
build: | ||
context: ./docker/dev | ||
image: local/pootle:dev | ||
env_file: | ||
- docker/dev/webapp.env | ||
environment: | ||
- LOCAL_USER_ID=1000 | ||
depends_on: | ||
- postgres | ||
- redis | ||
command: ["/home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", "server"] | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- .:/home/pootle/pootle_env/src/pootle | ||
|
||
# Dev app (mariadb) | ||
dev-mariadb: | ||
build: | ||
context: ./docker/dev-mariadb | ||
image: local/pootle:dev-mariadb | ||
env_file: | ||
- docker/dev-mariadb/webapp.env | ||
environment: | ||
- LOCAL_USER_ID=1000 | ||
depends_on: | ||
- mariadb | ||
- redis | ||
command: ["/home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", "server"] | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- .:/home/pootle/pootle_env/src/pootle | ||
|
||
# Dev app (sqlite) | ||
dev-sqlite: | ||
build: | ||
context: ./docker/dev-sqlite | ||
image: local/pootle:dev-sqlite | ||
env_file: | ||
- docker/dev-sqlite/webapp.env | ||
environment: | ||
- LOCAL_USER_ID=1000 | ||
depends_on: | ||
- redis | ||
command: ["/home/pootle/pootle_env/src/pootle/docker/bin/run_pootle", "server"] | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- .:/home/pootle/pootle_env/src/pootle | ||
|
||
mariadb: | ||
image: mariadb | ||
restart: always | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=CHANGEME | ||
- MYSQL_DATABASE=pootledb | ||
- MYSQL_USER=pootle | ||
- MYSQL_PASSWORD=CHANGEME | ||
|
||
postgres: | ||
image: postgres:9.4 | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=pootle | ||
- POSTGRES_PASSWORD=CHANGEME | ||
- POSTGRES_DB=pootledb | ||
|
||
redis: | ||
image: redis | ||
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# translate/pootle:dev-base | ||
# | ||
# VERSION 0.0.1 | ||
|
||
FROM debian:stretch-slim | ||
|
||
MAINTAINER Ryan Northey <ryan@synca.io> | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
INSTALL_DIR=~/pootle_env \ | ||
POOTLE_PKG='-e git://github.com/phlax/pootle@docker-dev#egg=pootle' | ||
|
||
ENV POOTLE_LOG_DIR="$INSTALL_DIR/var/logs" | ||
|
||
COPY ./base-install /usr/local/bin | ||
RUN ./usr/local/bin/base-install | ||
|
||
COPY ./base-install-gosu /usr/local/bin | ||
RUN ./usr/local/bin/base-install-gosu | ||
|
||
RUN mkdir -p $INSTALL_DIR \ | ||
&& chown -R pootle:pootle $INSTALL_DIR | ||
|
||
COPY ./base-install-virtualenv /usr/local/bin | ||
|
||
RUN sudo POOTLE_PKG="$POOTLE_PKG" INSTALL_DIR="$INSTALL_DIR" -u pootle ./usr/local/bin/base-install-virtualenv | ||
|
||
COPY ./base-install-dev-env /usr/local/bin | ||
RUN sudo INSTALL_DIR=$INSTALL_DIR -u pootle ./usr/local/bin/base-install-dev-env | ||
|
||
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
EXPOSE 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
apt-get update | ||
apt-get install -y \ | ||
build-essential \ | ||
coreutils \ | ||
curl \ | ||
git \ | ||
libjpeg-dev \ | ||
libfreetype6-dev \ | ||
liblcms2-dev \ | ||
libtiff5-dev \ | ||
libwebp-dev \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
locales \ | ||
python-pip \ | ||
python-dev \ | ||
sudo \ | ||
zlib1g-dev | ||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen | ||
locale-gen | ||
update-locale LANG=en_US.UTF-8 | ||
pip install virtualenv | ||
groupadd -r pootle | ||
useradd \ | ||
-m \ | ||
-d /home/pootle \ | ||
-k /etc/skel \ | ||
-s /bin/bash \ | ||
-g pootle \ | ||
pootle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
cd $INSTALL_DIR | ||
. bin/activate | ||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash | ||
. ~/.nvm/nvm.sh | ||
|
||
nvm install node | ||
cd src/pootle | ||
pip install -e .[test] | ||
pip install -e .[dev] | ||
cd ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
echo "Installing gosu..." | ||
|
||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 | ||
curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.10/gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }')" | ||
curl -o /usr/local/bin/gosu.asc \ | ||
-SL "https://github.com/tianon/gosu/releases/download/1.10/gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }').asc" | ||
gpg --verify /usr/local/bin/gosu.asc | ||
rm /usr/local/bin/gosu.asc | ||
chmod +x /usr/local/bin/gosu | ||
apt-get clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
echo "creating the virtualenv $INSTALL_DIR" | ||
|
||
echo $INSTALL_DIR | ||
|
||
cd $INSTALL_DIR | ||
virtualenv . | ||
. bin/activate \ | ||
&& pip install $POOTLE_PKG | ||
|
||
ls $(readlink --canonicalize $INSTALL_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Add local user | ||
# Either use the LOCAL_USER_ID if passed in at runtime or | ||
# fallback | ||
|
||
USER_ID=${LOCAL_USER_ID:-10001} | ||
|
||
echo "Starting with UID : $USER_ID" | ||
usermod -o -u $USER_ID pootle | ||
export HOME=/home/pootle | ||
exec /usr/local/bin/gosu pootle "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Runs bash command as pootle user | ||
|
||
CMD=$@ | ||
|
||
|
||
cd /home/pootle/pootle_env \ | ||
&& /bin/bash -c " | ||
cd $INSTALL_DIR \ | ||
&& . bin/activate \ | ||
&& cd src/pootle \ | ||
&& pip install -e . \ | ||
&& . ~/.nvm/nvm.sh \ | ||
&& nvm use node \ | ||
&& (if [ ! -e "$INSTALL_DIR/src/pootle/pootle/static/js/node_modules" ]; \ | ||
then \ | ||
cd $INSTALL_DIR/src/pootle/pootle/static/js/ \ | ||
&& npm install \ | ||
&& cd $INSTALL_DIR; \ | ||
fi) \ | ||
&& $CMD" |
Oops, something went wrong.