-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add docker setup for local ui development * remove ports config * fix dump import * NHUB-38 Co-authored-by: Petr Jasek <jasekpetr@gmail.com>
- Loading branch information
Showing
14 changed files
with
202 additions
and
28 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 |
---|---|---|
|
@@ -120,4 +120,4 @@ newsroom/static/dist | |
.pytest_cache | ||
|
||
# data dumps | ||
dump | ||
dump |
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
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
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
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
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 @@ | ||
# BUILD | ||
FROM node:14 | ||
|
||
# install client | ||
WORKDIR /opt/client | ||
|
||
COPY package.json . | ||
RUN npm install --no-audit --unsafe-perm | ||
|
||
COPY . . | ||
|
||
CMD ["npm", "run", "start"] |
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,16 @@ | ||
{ | ||
"scripts": { | ||
"start": "webpack-dev-server --progress --colors --content-base dist --host 0.0.0.0", | ||
"build": "webpack --progress --profile --colors" | ||
}, | ||
"dependencies": { | ||
"newsroom-core": "github:superdesk/newsroom-core#develop" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"webpack": "3.11.0", | ||
"webpack-dev-server": "2.11.1" | ||
} | ||
} |
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 @@ | ||
module.exports = require('newsroom-core/webpack.config') |
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,41 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
python3 python3-dev python3-pip python3-venv git gcc mongo-tools mongodb-clients curl \ | ||
# lxml | ||
libxml2-dev libxslt-dev \ | ||
# PIL | ||
libjpeg-dev zlib1g-dev \ | ||
# magic | ||
libmagic-dev \ | ||
# windows | ||
dos2unix \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# setup venv | ||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python3 -m venv "$VIRTUAL_ENV" | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
# update venv | ||
RUN python3 -m pip install -U pip wheel setuptools | ||
|
||
# install server | ||
WORKDIR /opt/newsroom/ | ||
COPY requirements.txt . | ||
RUN python3 -m pip install -Ur requirements.txt | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
ENV C_FORCE_ROOT=False | ||
ENV CELERYBEAT_SCHEDULE_FILENAME=/tmp/celerybeatschedule.db | ||
ENV TZ=Europe/London | ||
|
||
COPY . . | ||
|
||
# fix line endings when running docker on windows | ||
RUN dos2unix scripts/start.sh | ||
|
||
ENTRYPOINT ["bash", "/opt/newsroom/scripts/start.sh"] | ||
CMD ["honcho", "start", "-p 5050"] |
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,4 @@ | ||
web: gunicorn -b 0.0.0.0:$PORT -w 3 newsroom.web.app:app | ||
websocket: python -m newsroom.web.ws | ||
worker: celery -A newsroom.web.worker.celery -Q "${SUPERDESK_CELERY_PREFIX}newsroom" worker | ||
beat: celery -A newsroom.web.worker.celery beat --pid= |
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,6 @@ | ||
from newsroom.commands import * # noqa | ||
from newsroom.commands.manager import manager | ||
|
||
|
||
if __name__ == "__main__": | ||
manager.run() |
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 @@ | ||
git+https://github.com/superdesk/newsroom-core.git@develop#egg=Newsroom-Core |
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,31 @@ | ||
#!/bin/bash | ||
|
||
cd /opt/newsroom/ | ||
|
||
# wait for elastic to be up | ||
printf 'waiting for elastic.' | ||
until $(curl --output /dev/null --silent --fail "${ELASTICSEARCH_URL}"); do | ||
printf '.' | ||
sleep .5 | ||
done | ||
echo 'done.' | ||
|
||
# wait for client | ||
printf 'waiting for client.' | ||
until $(curl --output /dev/null --silent --fail "${WEBPACK_SERVER_URL}/manifest.json"); do | ||
printf '.' | ||
sleep .5 | ||
done | ||
echo 'done.' | ||
|
||
# app init | ||
python3 manage.py create_user admin@localhost.com admin admin admin true | ||
python3 manage.py elastic_init | ||
|
||
if [[ -d dump ]]; then | ||
echo 'installing demo data' | ||
mongorestore -h mongo --gzip dump | ||
python3 manage.py index_from_mongo --all | ||
fi | ||
|
||
exec "$@" |
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,4 @@ | ||
import pathlib | ||
|
||
SERVER_PATH = pathlib.Path(__file__).resolve().parent | ||
CLIENT_PATH = SERVER_PATH.parent.joinpath("client") |