Skip to content

Commit

Permalink
Merge pull request #106 from steemit/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
john-g-g authored Mar 20, 2018
2 parents a065599 + 6804966 commit 6320fa1
Show file tree
Hide file tree
Showing 234 changed files with 32,242 additions and 5,430 deletions.
Binary file added .DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
steps:
- checkout
- setup_remote_docker
- run: echo "Ignore CircleCI detected dependencies"
- run: docker build -t steemit/sbds .
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ local.db
*.db
envfile
/deploy
Pipfile.lockdump.sql
blocks.json
build_dir
35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8

[*.py]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 4

# isort config
force_single_line=True
from_first=False

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2


# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,9 @@ tests/failed_blocks/
/deploy/
blocks.json
my.cnf
dump.sql
blocks.json
build_dir
*.sql.gz
account_names.json
blocks_data/
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v0.9.5
hooks:
- id: check-ast
- id: trailing-whitespace
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-yaml
- id: check-symlinks
- id: check-case-conflict
- id: debug-statements
- id: check-merge-conflict
- id: detect-aws-credentials
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: mixed-line-ending
- id: autopep8-wrapper
args: ['-i', '-j 4','--max-line-length=100', '-a']
#- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
# sha: v1.1.0
# hooks:
# - id: dockerfile_lint
- repo: git://github.com/Lucas-C/pre-commit-hooks
sha: v1.1.4
hooks:
- id: remove-tabs
exclude: Makefile
- repo: git://github.com/detailyang/pre-commit-shell
sha: 1b26bf757e6d5b9bfed2566339c6464f44779678
hooks:
- id: shell-lint
files: run$
- repo: local
hooks:
- id: check-bash-syntax
name: Check Shell scripts syntax corectness
language: system
entry: bash -n
files: run$
68 changes: 53 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,88 @@
FROM phusion/baseimage:0.9.19

ENV DATABASE_URL sqlite:////tmp/sqlite.db
ENV STEEMD_HTTP_URL https://steemd.steemitdev.com
ENV STEEMD_HTTP_URL https://steemd.steemit.com
ENV SBDS_LOG_LEVEL INFO
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV APP_ROOT /app
ENV WSGI_APP ${APP_ROOT}/sbds/server/serve.py
ENV HTTP_SERVER_PORT 8080
ENV HTTP_SERVER_STATS_PORT 9191
ENV SBDS_ENVIRONMENT DEV
ENV SBDS_APP_HTTP_PORT 9000

ENV PIPENV_DEFAULT_PYTHON_VERSION 3.6.4

ENV NGINX_SERVER_PORT 8080

RUN \
apt-get update && \
apt-get install -y \
build-essential \
checkinstall \
daemontools \
git \
libbz2-dev \
libc6-dev \
libffi-dev \
libgdbm-dev \
libmysqlclient-dev \
libncursesw5-dev \
libreadline-gplv2-dev \
libsqlite3-dev \
libssl-dev \
make \
python3 \
python3-dev \
python3-pip \
libxml2-dev \
libxslt-dev \
nginx \
nginx-extras \
make \
lua-zlib \
runit \
libpcre3 \
libpcre3-dev
tk-dev \
wget && \
apt-get clean


RUN \
pip3 install --upgrade pip && \
pip3 install uwsgi
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz && \
tar xvf Python-3.6.4.tar.xz && \
cd Python-3.6.4/ && \
./configure && \
make altinstall && \
cd .. && \
rm -rf Python-3.6.4.tar.xz Python-3.6.4/

ADD . /app
# nginx
RUN \
mkdir -p /var/lib/nginx/body && \
mkdir -p /var/lib/nginx/scgi && \
mkdir -p /var/lib/nginx/uwsgi && \
mkdir -p /var/lib/nginx/fastcgi && \
mkdir -p /var/lib/nginx/proxy && \
chown -R www-data:www-data /var/lib/nginx && \
mkdir -p /var/log/nginx && \
touch /var/log/nginx/access.log && \
touch /var/log/nginx/access.json && \
touch /var/log/nginx/error.log && \
chown www-data:www-data /var/log/nginx/* && \
touch /var/run/nginx.pid && \
chown www-data:www-data /var/run/nginx.pid && \
mkdir -p /var/www/.cache && \
chown www-data:www-data /var/www/.cache

RUN \
python3.6 -m pip install --upgrade pip && \
python3.6 -m pip install pipenv

COPY . /app

RUN \
mv /app/service/* /etc/service && \
chmod +x /etc/service/*/run

WORKDIR /app

RUN pipenv install --python 3.6 --dev

RUN \
pip3 install . && \
apt-get remove -y \
build-essential \
libffi-dev \
Expand All @@ -59,4 +98,3 @@ RUN \
/usr/local/include

EXPOSE ${HTTP_SERVER_PORT}
EXPOSE ${HTTP_SERVER_STATS_PORT}
Loading

0 comments on commit 6320fa1

Please sign in to comment.