Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:eventoL/eventoL into dependabot/…
Browse files Browse the repository at this point in the history
…pip/develop/psycopg2-binary-2.7.6.1
  • Loading branch information
FedeG committed Oct 4, 2019
2 parents 59ae53a + f918daa commit 7048f62
Show file tree
Hide file tree
Showing 146 changed files with 14,216 additions and 6,795 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ docs/
eventol/front/node_modules/
eventol/front/eventol/static/manager/bower_components/
.vscode/
deploy/docker/db/postgres/
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ nosetests.xml

# Translations
*.mo
eventol/conf/locale/en/
eventol/conf/locale/**/*.mo

# Mr Developer
.mr.developer.cfg
Expand Down Expand Up @@ -77,6 +79,8 @@ coverage/
jest_*
venv/
.vscode/
*.orig


.config/
deploy/docker/.env
Expand Down
35 changes: 14 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,70 +52,63 @@ python-testing:
POSTGRES_DB: eventol
POSTGRES_USER: eventol
POSTGRES_PASSWORD: secret
image: python:3.6
image: python:3.7
stage: testing
script:
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt install -y nodejs
- npm install -g yarn yarnpkg
- cd eventol/front
- yarn install
- yarn build
- cd -
- ./test.sh -i backend
- make gitlab-python-testing
artifacts:
paths:
- eventol/htmlcov

react-testing:
image: node:8
image: node:10
stage: testing
script:
- ./test.sh -i frontend
- make gitlab-react-testing
artifacts:
paths:
- eventol/front/coverage

python-lint:
image: python:3.5
image: python:3.7
stage: styling
allow_failure: true
script:
- ./test.sh -i pythonlint
- make gitlab-python-lint

react-lint-report:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
- ./test.sh -i lint-report
- make gitlab-react-lint-with-report
artifacts:
paths:
- eventol/front/report.html

react-lint:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
- ./test.sh -i lint
- make gitlab-react-lint

sass-lint-report:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
- ./test.sh -i sass-lint-report
- make gitlab-react-sasslint-with-report
artifacts:
paths:
- eventol/front/scss-lint-report.html

sass-lint:
image: node:8
image: node:10
stage: styling
allow_failure: true
script:
- ./test.sh -i sass-lint
- make gitlab-react-sasslint

deploy:
stage: deploy
Expand Down
11 changes: 9 additions & 2 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
esversion: 6

jshint:
enabled: false

python:
enabled: true
config_file: .pylintrc

prettier:
enabled: true
config_file: eventol/front/.prettierrc

eslint:
enabled: true
config_file: eventol/front/.eslintrc.yaml
config_file: eventol/front/.eslintrc.json

javascript:
enable: true
esversion: 6
config_file: eventol/front/.eslintrc.yaml
config_file: eventol/front/.eslintrc.json

scss:
enabled: true
Expand Down
52 changes: 8 additions & 44 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
sudo: required
dist: xenial
language: python
python:
- "3.6"
- "3.7"
env:
global:
- DB=postgres
- PSQL_PORT=5000
- PSQL_VERSION=9.6
- PSQL_USER=eventol
- NODE_VERSION=10.15
- YARN_VERSION=1.13.0
- PSQL_DBNAME=eventol
- PSQL_HOST=localhost
- PSQL_PASSWORD=secret
- CC_TEST_REPORTER_ID=74cbdb599d4cabc78a5dd07f26f1ddcc36910ffca3104c35c2ba66603818031c
matrix:
- DJANGO=1.11.20
- DJANGO=1.11.21
services:
- docker
cache:
Expand All @@ -24,42 +19,11 @@ cache:
directories:
- eventol/front/node_modules
before_install:
- docker run --name eventol-postgres -e POSTGRES_PASSWORD=$PSQL_PASSWORD -e POSTGRES_USER=$PSQL_USER -e POSTGRES_DB=$PSQL_DBNAME -p $PSQL_PORT:5432 -d postgres:$PSQL_VERSION
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
- export PATH=$HOME/.yarn/bin:$PATH
- nvm install $NODE_VERSION
- make travis-before
install:
- pip install -U pip wheel
- pip install coverage coveralls
- pip install -r requirements.txt
- pip install -r requirements-dev.txt
- make backend-install-dev
- make travis-install-dependencies
script:
- cd eventol/front
- yarn install
- yarn build
- cd -
- mkdir -p eventol/static
- cd eventol
- python manage.py makemigrations manager
- python manage.py migrate
- python manage.py collectstatic --noinput
- py.test --cov-report xml --cov-report term-missing --cov-report html --cov --cov-branch
- cd -
- cd eventol/front
- yarn install
- yarn test
- cd -
- make travis-script
after_success:
- cd eventol
- coverage report
- coveralls
- cd -
- mv cc-test-reporter eventol/cc-test-reporter
- cd eventol
- ./cc-test-reporter format-coverage -d -t coverage.py -o coverage/python.json --add-prefix eventol
- ./cc-test-reporter format-coverage ./front/coverage/lcov.info -d -t lcov -o ./coverage/javascript.json --add-prefix eventol
- ./cc-test-reporter sum-coverage --output coverage/codeclimate.json -d -p 2 coverage/python.json coverage/javascript.json
- ./cc-test-reporter upload-coverage -d
- make travis-after
133 changes: 71 additions & 62 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,81 +1,99 @@
FROM python:3.5-alpine
#########################################
# frontend image
#########################################
FROM node:12.10.0-alpine as frontend

# Set environment variables
ENV APP_ROOT /usr/src/app
ENV APP_USER_NAME app
ENV APP_USER_UID 1000
ENV IS_ALPINE true
ENV NODE_VERSION 8.x
## Install system dependencies
RUN apk --update add --no-cache \
git gcc make autoconf automake musl-dev \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install alpine dependencies
# Install bower and less
RUN npm install -g bower less

## Upgrade apk-tools
RUN apk add --upgrade --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main apk-tools
# Set working directory
WORKDIR /app
RUN chown -R node:node /app

## Install system dependencies
RUN apk --update add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
bash wget dpkg-dev libffi nodejs nodejs-npm git gcc musl-dev gettext \
postgresql-dev libffi-dev py3-setuptools jpeg-dev make \
zlib-dev freetype-dev lcms2-dev openjpeg-dev libxslt-dev alpine-sdk \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set user
USER node

# Install yarn dependencies
COPY --chown=node:node ./eventol/front/package.json ./eventol/front/yarn.lock ./
RUN yarn install

# Install bower dependencies
COPY --chown=node:node ./eventol/front/bower.json ./eventol/front/.bowerrc ./
RUN bower install

# Build less files
COPY --chown=node:node ./eventol/front/eventol/static/manager/less/ ./eventol/static/manager/less/
RUN mkdir -p ./eventol/static/manager/css/
RUN lessc ./eventol/static/manager/less/eventol.less > ./eventol/static/manager/css/eventol.css
RUN lessc ./eventol/static/manager/less/eventol-bootstrap.less > ./eventol/static/manager/css/eventol-bootstrap.css

# Copy code
COPY --chown=node:node ./eventol/front/ .

# Build
RUN yarn build

EXPOSE 3000

CMD ["tail", "-f", "/dev/null"]

#########################################
# build image
#########################################
FROM python:3.7.4-alpine as development

## Install react dependencies
RUN npm install -g npm
RUN npm install -g yarn webpack@^1.12.13 bower less
# Set environment variables
ENV APP_ROOT /usr/src/app/
ENV IS_ALPINE true
ENV DJANGO_CONFIGURATION=Prod

# Install system dependencies
RUN apk --update add --no-cache \
bash git gcc cairo-dev postgresql-dev libxslt-dev \
gettext musl-dev py3-setuptools jpeg-dev \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/* /tmp/* /var/tmp/*

## Install python dependencies
RUN pip3 install --no-cache-dir cffi cairocffi psycopg2
RUN apk --update add --no-cache cairo-dev \
&& rm -rf /var/cache/apk/* /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Create user
RUN adduser -D -h ${APP_ROOT} \
-s /bin/bash \
-u ${APP_USER_UID} \
${APP_USER_NAME}

# Create folders for deploy
RUN mkdir -p ${APP_ROOT}
RUN mkdir -p /var/log/eventol
RUN chown ${APP_USER_NAME}:root /var/log/eventol
WORKDIR ${APP_ROOT}

# Create user
RUN adduser -D -h ${APP_ROOT} -s /bin/bash app
RUN chown app:app /var/log/eventol

# Install python requirements
COPY ./requirements.txt ${APP_ROOT}
COPY ./requirements-dev.txt ${APP_ROOT}
RUN pip3 install --no-cache-dir -r requirements.txt
COPY --chown=app:app ./requirements.txt ./requirements-dev.txt ${APP_ROOT}
RUN pip3 install --no-cache-dir -r requirements-dev.txt

# Install node modules
COPY ./eventol/front/package.json ${APP_ROOT}/eventol/front/
COPY ./eventol/front/yarn.lock ${APP_ROOT}/eventol/front/
RUN cd ${APP_ROOT}/eventol/front && yarn install
RUN cd ${APP_ROOT}/eventol/front && npm rebuild node-sass --force

# Install bower dependencies
COPY ./eventol/front/bower.json ${APP_ROOT}/eventol/front/
COPY ./eventol/front/.bowerrc ${APP_ROOT}/eventol/front/
RUN cd ${APP_ROOT}/eventol/front && bower install --allow-root

# Copy test script file
COPY ./test.sh ${APP_ROOT}/test.sh
# Set user
USER app

# Copy python code
COPY ./eventol ${APP_ROOT}/eventol
COPY --chown=app:app ./eventol ${APP_ROOT}/eventol
RUN mkdir -p ${APP_ROOT}/eventol/manager/static
RUN mkdir -p ${APP_ROOT}/eventol/front/eventol/static

# Compile scss
RUN mkdir -p ${APP_ROOT}/eventol/manager/static/manager/css/
RUN lessc ${APP_ROOT}/eventol/front/eventol/static/manager/less/eventol.less > ${APP_ROOT}/eventol/manager/static/manager/css/eventol.css
RUN lessc ${APP_ROOT}/eventol/front/eventol/static/manager/less/eventol-bootstrap.less > ${APP_ROOT}/eventol/manager/static/manager/css/eventol-bootstrap.css
# Copy css
COPY --chown=app:app --from=frontend /app/eventol/static/manager/css/ ${APP_ROOT}/eventol/manager/static/manager/css/

# Copy script for docker-compose wait and start-eventol
COPY ./deploy/docker/scripts/wait-for-it.sh ${APP_ROOT}/wait-for-it.sh
COPY ./deploy/docker/scripts/start_eventol.sh ${APP_ROOT}/start_eventol.sh
# Copy frontend files
COPY --chown=app:app --from=frontend /app/webpack-stats-prod.json ${APP_ROOT}/eventol/front/webpack-stats-prod.json
COPY --chown=app:app --from=frontend /app/eventol/static ${APP_ROOT}/eventol/front/eventol/static

# Compile reactjs code
RUN cd ${APP_ROOT}/eventol/front && webpack --config webpack.prod.config.js
# Copy script for docker-compose wait and start-eventol
COPY --chown=app:app ./deploy/docker/scripts/wait-for-it.sh ${APP_ROOT}/wait-for-it.sh
COPY --chown=app:app ./deploy/docker/scripts/start_eventol.sh ${APP_ROOT}/start_eventol.sh

# Collect statics
RUN mkdir -p ${APP_ROOT}/eventol/static
Expand All @@ -84,15 +102,6 @@ RUN cd ${APP_ROOT}/eventol && python manage.py collectstatic --noinput
# Create media folder
RUN mkdir -p ${APP_ROOT}/eventol/media

# Clean and chown files
RUN rm -rf ${APP_ROOT}/eventol/front \
&& mkdir -p ${APP_ROOT}/eventol/front
RUN chmod 0755 ${APP_ROOT}
RUN chown --changes --recursive ${APP_USER_NAME}:${APP_USER_NAME} ${APP_ROOT}/

# Drop privs
USER ${APP_USER_NAME}

# Create log file
RUN touch /var/log/eventol/eventol.log

Expand All @@ -105,4 +114,4 @@ EXPOSE 8000
VOLUME ${APP_ROOT}/eventol/media
VOLUME ${APP_ROOT}/eventol/static

CMD ["tail", "-f", "/dev/null"]
CMD ["tail", "-f", "/dev/null"]
Loading

0 comments on commit 7048f62

Please sign in to comment.