Skip to content

Commit

Permalink
V3/better ui api (#102)
Browse files Browse the repository at this point in the history
new UI
  • Loading branch information
jaesivsm authored May 3, 2020
1 parent 163ad01 commit d6081cb
Show file tree
Hide file tree
Showing 121 changed files with 15,904 additions and 3,097 deletions.
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@ jobs:
- ~/caches/jarr-server.tar
- ~/caches/jarr-worker.tar

front-build:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
# restore cache and docker layer cache
- restore_cache:
keys:
- jarr-{{ .Branch }}
paths:
- ~/caches/jarr-front.tar
- run:
name: Loading docker image layer caches
command: |
set +o pipefail
docker load -i ~/caches/jarr-front.tar | true
- run:
name: Building images for front
command: |
mkdir -p ~/caches
export PUBLIC_URL=""
export REACT_APP_API_URL=https://api.jarr.info
make build-front
- run:
name: Saving docker image layer caches
command: |
docker save -o ~/caches/jarr-front.tar jarr-front
- save_cache:
key: jarr-{{ .Branch }}-{{ epoch }}
paths:
- ~/caches/jarr-front.tar

backend-test:
machine:
image: ubuntu-1604:201903-01
Expand Down Expand Up @@ -122,12 +154,14 @@ jobs:
paths:
- ~/caches/jarr-server.tar
- ~/caches/jarr-worker.tar
- ~/caches/jarr-front.tar
- run:
name: Loading ALL docker image layer caches
command: |
set +o pipefail
docker load -i ~/caches/jarr-server.tar
docker load -i ~/caches/jarr-worker.tar
docker load -i ~/caches/jarr-front.tar
- run:
name: Pushing tested images to registry
command: |
Expand All @@ -139,19 +173,23 @@ jobs:
fi
docker image tag jarr-server $DOCKER_USER/jarr-server:$DOCKER_TAG
docker image tag jarr-worker $DOCKER_USER/jarr-worker:$DOCKER_TAG
docker image tag jarr-front $DOCKER_USER/jarr-front:$DOCKER_TAG
docker push $DOCKER_USER/jarr-server:$DOCKER_TAG
docker push $DOCKER_USER/jarr-worker:$DOCKER_TAG
docker push $DOCKER_USER/jarr-front:$DOCKER_TAG
workflows:
jarr-testing:
jobs:
- backend-build
- front-build
- backend-test:
requires:
- backend-build
- push-docker-images:
requires:
- backend-test
- front-build
filters:
branches:
only:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ build

# node files
node_modules
jarr/views/static/js/bundle.min.js

# docker compose
.jarr-data/
2 changes: 1 addition & 1 deletion Dockerfiles/dev-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
ports:
- 0.0.0.0:5432:5432
volumes:
- ../jarr-data:/var/lib/postgresql/data
- ../.jarr-data:/var/lib/postgresql/data
command:
- "postgres"
- "-c"
Expand Down
11 changes: 11 additions & 0 deletions Dockerfiles/front
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:12.16.1 as build-deps
WORKDIR /jarr
RUN yarn global add serve
COPY jsclient/package.json jsclient/yarn.lock ./
RUN yarn
COPY jsclient/src/ /jarr/src
COPY jsclient/public/ /jarr/public
RUN yarn build
RUN rm -rf src public node_modules
EXPOSE 80
CMD ["serve", "-p", "80", "-s", "/jarr/build"]
43 changes: 31 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
GUNICORN_CONF = example_conf/gunicorn.py
LOG_CONFIG = example_conf/logging.ini
CONF_FILE = example_conf/jarr.json
CONF_FILE ?= example_conf/jarr.json
SERVER_PORT = 8000
SERVER_ADDR = 0.0.0.0
DB_VER = $(shell pipenv run ./manager.py db heads | sed -e 's/ .*//g')
ENV = dev
COMPOSE = pipenv run docker-compose --project-name jarr --file Dockerfiles/$(ENV)-env.yml
RUN = pipenv run
COMPOSE = $(RUN) docker-compose --project-name jarr --file Dockerfiles/$(ENV)-env.yml
TEST = tests/
DB_NAME ?= jarr

install:
pipenv sync --dev

pep8:
pipenv run pycodestyle --ignore=E126,E127,E128,W503 jarr/ --exclude=jarr/migrations
$(RUN) pycodestyle --ignore=E126,E127,E128,W503 jarr/ --exclude=jarr/migrations

mypy:
pipenv run mypy jarr --ignore-missing-imports
$(RUN) mypy jarr --ignore-missing-imports

lint: pep8 mypy

test: export JARR_CONFIG = example_conf/jarr.test.json
test:
pipenv run nosetests $(TEST) -vv --with-coverage --cover-package=jarr
$(RUN) nosetests $(TEST) -vv --with-coverage --cover-package=jarr

build-base:
docker build --cache-from=jarr . --file Dockerfiles/pythonbase -t jarr-base
Expand All @@ -32,26 +34,34 @@ build-server: build-base
build-worker: build-base
docker build --cache-from=jarr . --file Dockerfiles/worker -t jarr-worker

build-front:
docker build . --file Dockerfiles/front -t jarr-front \
--build-arg PUBLIC_URL \
--build-arg REACT_APP_API_URL

start-env:
$(COMPOSE) up -d

run-server: export JARR_CONFIG = $(CONF_FILE)
run-server:
pipenv run gunicorn -c $(GUNICORN_CONF) -b $(SERVER_ADDR):$(SERVER_PORT) wsgi:application
$(RUN) gunicorn -c $(GUNICORN_CONF) -b $(SERVER_ADDR):$(SERVER_PORT) wsgi:application

run-worker: export JARR_CONFIG = $(CONF_FILE)
run-worker:
pipenv run celery worker --app ep_celery.celery_app
$(RUN) celery worker --app ep_celery.celery_app

run-front:
cd jsclient/; yarn start

create-db:
$(COMPOSE) exec postgresql su postgres -c \
"createuser jarr --no-superuser --createdb --no-createrole"
$(COMPOSE) exec postgresql su postgres -c "createdb jarr --no-password"
"createuser $(DB_NAME) --no-superuser --createdb --no-createrole"
$(COMPOSE) exec postgresql su postgres -c "createdb $(DB_NAME) --no-password"

init-env: export JARR_CONFIG = $(CONF_FILE)
init-env: create-db
pipenv run ./manager.py db_create
pipenv run ./manager.py db stamp $(DB_VER)
init-env:
$(RUN) ./manager.py db_create
$(RUN) ./manager.py db stamp $(DB_VER)

stop-env:
$(COMPOSE) down --remove-orphans
Expand All @@ -61,3 +71,12 @@ clean-env: stop-env

status-env:
$(COMPOSE) ps

setup-testing: export DB_NAME=jarr_test
setup-testing: export JARR_CONFIG=example_conf/jarr.test.json
setup-testing: export CONF_FILE=example_conf/jarr.test.json
setup-testing:
make start-env
sleep 2
make create-db
make init-env
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ celery = "==4.2.1"
feedparser = "==5.2.1"
json-logging-py = "==0.2"
Flask = "==1.0.2"
Flask-Migrate = "==2.1.1"
Flask-Script = "==2.0.6"
flask-restx = "==0.1.1"
flask-jwt = "==0.3.2"
gunicorn = "==19.9.0"
lxml = "==4.1.1"
opml = "==0.5"
"psycopg2" = "==2.7.3.2"
"psycopg2" = "==2.8.5"
python-dateutil = "==2.6.1"
pytz = "==2017.2"
rauth = "==0.7.3"
redis = "==2.10.6"
requests = "==2.21.0"
SQLAlchemy = "==1.3.3"
the-conf = "==0.0.13"
flask-cors = "3.0.8"

[requires]
python_version = "3"
Loading

0 comments on commit d6081cb

Please sign in to comment.