Skip to content

Commit 6729e9b

Browse files
authored
Merge pull request #3 from code-lts/improvements
Improvements and cleanups
2 parents 8226507 + 6f2c0d7 commit 6729e9b

16 files changed

Lines changed: 4686 additions & 439 deletions

.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
env
22
dumps
33
node_modules
4-
bower_components
54
fake
65
tmp
76
logs
87
secure_settings.py
98
load-tests
109
.git
11-
.tox
10+
.tox

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[Makefile]
11+
indent_style = tab
12+
indent_size = 4

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ nosetests.xml
4242
*.csv
4343
\#*
4444
/.hash-before-release
45-
/bower_components/
4645
/dumps/
4746
/fake/
4847
/tmp/
@@ -51,4 +50,4 @@ nosetests.xml
5150
/.env
5251
/env-to-remove/
5352
.tern-port
54-
/.env-debug-amch-client
53+
/.env-debug-amch-client

Dockerfile

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
FROM ubuntu:14.04
2-
MAINTAINER Alexander Artemenko <svetlyak.40wt@gmail.com>
1+
FROM python:2-slim
2+
LABEL MAINTAINER="Alexander Artemenko <svetlyak.40wt@gmail.com>"
33

4-
# Prepare
54
ENV DEBIAN_FRONTEND=noninteractive
65

76
RUN apt-get update && \
@@ -12,34 +11,17 @@ RUN apt-get update && \
1211
libssl-dev \
1312
libxml2-dev \
1413
libxslt1-dev \
15-
mysql-client-core-5.5 \
16-
libmysqlclient-dev \
14+
mariadb-client \
15+
default-libmysqlclient-dev \
1716
libffi-dev \
1817
git \
1918
mercurial \
2019
python-qt4 \
2120
xvfb
2221

23-
RUN virtualenv --python=python2 /env
24-
RUN /env/bin/pip install pip==8.0.2
25-
26-
#COPY ./wheelhouse /wheelhouse
2722
COPY ./requirements/dev.txt /requirements.txt
2823
COPY ./requirements/from-git.txt /requirements-from-git.txt
2924

30-
# disable wheelhouse for Drone builds
31-
# RUN /env/bin/pip install --use-wheel --no-index --find-links=/wheelhouse -r /requirements.txt
32-
RUN /env/bin/pip install -r /requirements.txt
33-
RUN /env/bin/pip install -r /requirements-from-git.txt
34-
35-
COPY . /app
36-
WORKDIR /app
37-
38-
RUN find . -name '*.pyc' -print0 | xargs -0 rm -f
39-
RUN /env/bin/pip install -e /app
40-
41-
ENV PATH=/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
42-
43-
COPY ./configs/.pdbrc.py /root/
44-
45-
#ENTRYPOINT ["./manage.py"]
25+
RUN pip install --upgrade pip
26+
RUN pip install -r /requirements.txt
27+
RUN pip install -r /requirements-from-git.txt

Makefile

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.PHONY: all build_static get_latest_db restore_db backup_dev_db create_postgres drop_postgres connect_to_postgres create_database drop_database dbshell push_to_amch build_wheels build_image push_image migrate
2+
3+
CURRENT_VERSION = `cat CURRENT_VERSION`
4+
5+
all:
6+
@echo "Current version: ${CURRENT_VERSION}"
7+
8+
build_static: # Build static javascript and css files.
9+
yarn run gulp
10+
11+
get_latest_db:
12+
scp clupea:/mnt/yandex.disk/backups/mysql/allmychanges/latest.sql.bz2 dumps/
13+
14+
RESTORE_DB = 'latest'
15+
restore_db:
16+
docker exec -ti mysql.allmychanges.com /dumps/restore.sh ${RESTORE_DB}
17+
18+
backup_dev_db:
19+
docker exec mysql.allmychanges.com mysqldump -ppassword allmychanges > dumps/dev.sql
20+
21+
create_postgres:
22+
# https://hub.docker.com/_/postgres/
23+
# how to run psql
24+
# $
25+
docker exec -it postgres.allmychanges.com postgresadmin -ppassword create allmychanges
26+
27+
drop_postgres:
28+
docker exec -it postgres.allmychanges.com postgresadmin -ppassword drop allmychanges
29+
create_postgres
30+
31+
connect_to_postgres:
32+
docker run -it --net amch --rm postgres \
33+
sh -c 'exec psql -h postgres.allmychanges.com -p 5432 -U postgres'
34+
35+
create_database:
36+
docker exec -it mysql.allmychanges.com mysqladmin -ppassword create allmychanges
37+
38+
drop_database:
39+
docker exec -it mysql.allmychanges.com mysqladmin -ppassword drop allmychanges
40+
create_database
41+
42+
dbshell:
43+
docker exec -it mysql.allmychanges.com mysql -ppassword allmychanges
44+
45+
push_to_amch:
46+
time pip2amch --tag allmychanges.com requirements/production.txt | amch push
47+
48+
build_wheels:
49+
docker run --rm -v `pwd`:/wheels 40ants/wheel-builder --wheel-dir wheelhouse -r requirements/dev.txt
50+
51+
DEV_TAG = 'allmychanges.com:dev'
52+
build_image:
53+
docker build ./ -t ${DEV_TAG}
54+
@echo "Built ${DEV_TAG}"
55+
56+
TAG = "registry.40ants.com:5000/allmychanges.com:${CURRENT_VERSION}"
57+
push_image:
58+
@echo "Using tag: ${TAG}"
59+
docker build ./ -t ${TAG}
60+
docker push ${TAG}
61+
@echo "Pushed ${TAG}"
62+
63+
update_requirements:
64+
pip-compile --annotate requirements.in
65+
pip-compile --annotate requirements-dev.in
66+
67+
SERVER_PORT=80
68+
run_server:
69+
python ./manage.py runserver 0.0.0.0:${SERVER_PORT}
70+
71+
migrate:
72+
python ./manage.py migrate

0 commit comments

Comments
 (0)