Skip to content
Snippets Groups Projects
Commit 662c5cf3 authored by Ryan Sanford's avatar Ryan Sanford
Browse files

Refactor pip install out of Dockerfile

- Entrypoint has new $PRE_RUNAS_CMD that allows running of root tasks before dropping privs.
- Added $SCITRAN_RUNTIME_PROTOCOL for explicit designation of http vs https.
- Updated README.md examples.
- No longer using requirements_dev.txt due to long install time.
parent cca75e74
No related branches found
No related tags found
No related merge requests found
......@@ -59,12 +59,11 @@ VOLUME /var/scitran/logs
#
# Split this out for better cache re-use.
#
COPY requirements.txt requirements_dev.txt docker/requirements-docker.txt /var/scitran/code/api/
COPY requirements.txt docker/requirements-docker.txt /var/scitran/code/api/
RUN pip install --upgrade pip wheel setuptools \
&& pip install -r /var/scitran/code/api/requirements-docker.txt \
&& pip install -r /var/scitran/code/api/requirements.txt \
&& pip install -r /var/scitran/code/api/requirements_dev.txt
&& pip install -r /var/scitran/code/api/requirements.txt
# Copy full repo
......
......@@ -22,6 +22,7 @@ preserving their contents across container instances.
--name scitran-core \
-e "SCITRAN_PERSISTENT_DB_URI=mongodb://some-mongo:27017/scitran" \
-e "SCITRAN_CORE_INSECURE=true" \
-e "SCITRAN_CORE_DRONE_SECRET=change-me" \
-v $(pwd)/persistent/data:/var/scitran/data \
-v $(pwd):/var/scitran/code/api \
--link some-mongo \
......@@ -30,26 +31,34 @@ preserving their contents across container instances.
uwsgi \
--ini /var/scitran/config/uwsgi-config.ini \
--http 0.0.0.0:8080 \
--http-keepalive \
--python-autoreload 1
# Bootstrap Account Example:
docker run \
-e "SCITRAN_PERSISTENT_DB_URI=mongodb://some-mongo:27017/scitran" \
--link some-mongo \
-e "SCITRAN_RUNTIME_HOST=scitran-core" \
-e "SCITRAN_RUNTIME_PORT=8080" \
-e "SCITRAN_RUNTIME_PROTOCOL=http" \
-e "SCITRAN_CORE_DRONE_SECRET=change-me" \
--link scitran-core \
--rm \
-v /dev/bali.prod/docker/uwsgi/bootstrap-dev.json:/accounts.json \
scitran/core \
-v /dev/bali.prod/docker/uwsgi/bootstrap.json:/accounts.json \
scitran-core \
/var/scitran/code/api/docker/bootstrap-accounts.sh \
/accounts.json
# Bootstrap Data Example:
docker run \
-e "SCITRAN_PERSISTENT_DB_URI=mongodb://some-mongo:27017/scitran" \
--link some-mongo \
-e "SCITRAN_RUNTIME_HOST=scitran-core" \
-e "SCITRAN_RUNTIME_PORT=8080" \
-e "SCITRAN_RUNTIME_PROTOCOL=http" \
-e "SCITRAN_CORE_DRONE_SECRET=change-me" \
--link scitran-core \
--volumes-from scitran-core \
--rm \
scitran/core \
scitran-core \
/var/scitran/code/api/docker/bootstrap-data.sh
```
......@@ -77,5 +86,6 @@ docker run \
uwsgi \
--ini /var/scitran/config/uwsgi-config.ini \
--http 0.0.0.0:8080 \
--http-keepalive \
--python-autoreload 1
```
......@@ -21,6 +21,9 @@ cd /var/scitran/code/api
export PYTHONPATH=.
# Set API URL
API_URL="$SCITRAN_RUNTIME_PROTOCOL://$SCITRAN_RUNTIME_HOST:$SCITRAN_RUNTIME_PORT/api"
# Bootstrap Users
./bin/bootstrap.py --insecure --secret "${SCITRAN_CORE_DRONE_SECRET}" "${API_URL}" "${bootstrap_user_file}"
......
......@@ -24,6 +24,9 @@ GET_LATEST_DATA=${1:-N}
bootstrap_data_label=9362b768d54caf6e5cd35f00498208c3b2bff77d
bootstrap_data_label=reaping
# Same as bootstrap_data_label above, except for scitran/reaper.
bootstrap_reaper_label=folder-reaper
# Move to API folder for relative path assumptions later on
#
......@@ -64,9 +67,12 @@ else
fi
builtin echo "$TESTDATA_VERSION" > "$TESTDATA_DIR/.testdata_version"
# pull reaper module
pip install "git+https://github.com/scitran/reaper.git@${bootstrap_reaper_label}"
## delete .DS_Store files, as the reaper at this point doesn't like them.
find "$TESTDATA_DIR/download/" -name ".DS_Store" -type f -delete
# Set API URL
API_URL="$SCITRAN_RUNTIME_PROTOCOL://$SCITRAN_RUNTIME_HOST:$SCITRAN_RUNTIME_PORT/api"
## load the test data in
folder_reaper --insecure --secret "${SCITRAN_CORE_DRONE_SECRET}" "${API_URL}" "$TESTDATA_DIR/download"
......
......@@ -32,6 +32,11 @@ if [ "${1:0:1}" = '-' ]; then
set -- uwsgi "$@"
fi
# run $PRE_RUNAS_CMD as root if provided. Useful for things like JIT pip insalls.
if [ ! -z "${PRE_RUNAS_CMD}" ]; then
${PRE_RUNAS_CMD}
fi
if [ "$1" = 'uwsgi' ]; then
exec gosu ${RUNAS_USER} "$@"
fi
......
......@@ -2,6 +2,7 @@
#SCITRAN_RUNTIME_HOST="127.0.0.1"
#SCITRAN_RUNTIME_PORT="8080"
#SCITRAN_RUNTIME_PROTOCOL="https"
#SCITRAN_RUNTIME_PATH="./runtime"
#SCITRAN_RUNTIME_SSL_PEM="*"
#SCITRAN_RUNTIME_BOOTSTRAP="bootstrap.json"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment