Skip to content

Commit 8ce5477

Browse files
authored
Merge pull request #194 from rambo/fix_build
Make docker builds work again
2 parents 497b1c9 + 223e4a6 commit 8ce5477

File tree

17 files changed

+85
-23
lines changed

17 files changed

+85
-23
lines changed

.dockerignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.idea
2+
._*
3+
.DS_Store
4+
.cache/
5+
staticfiles/
6+
media/
7+
bower_components/
8+
asylum/static/css/
9+
asylum/static/js/
10+
asylum/static/fonts/
11+
venv/
12+
.AppleDouble
13+
.LSOverride
14+
*.py[cod]
15+
*.pyc
16+
__pycache__
17+
*.log
18+
node_modules/
19+
project/asylum/media/
20+
*_backup.tar.gz
21+
.git

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Everyone should keep their own configs
2+
.idea
13
# OSX stuff
24
._*
35
.DS_Store

docker/dev.sh

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
#!/bin/sh
1+
#!/bin/bash -e
2+
SCRIPTDIR=$(python -c 'import os,sys;print os.path.dirname(os.path.realpath(sys.argv[1]))' "$0")
23

3-
docker build -t asylum_dev .
4-
docker run --name asylum_dev -d -p 8000:8000 -p 1080:1080 -v `pwd -P`/project:/opt/asylum asylum_dev
5-
read -p "Press enter to stop and remove the server" dummy
6-
docker stop asylum_dev
7-
docker rm asylum_dev
4+
# Make sure we're in the correct place relative to Dockerfile no matter where we were called from
5+
cd `dirname "$SCRIPTDIR"`
86

7+
if [ "$( docker images asylum_dev:latest )" == "" ]
8+
then
9+
docker build -t asylum_dev .
10+
fi
11+
echo "Starting devel server."
12+
echo "To connect to shell in this instance run: docker exec -it asylum_dev /bin/bash"
13+
echo "Then in that shell run: source ../asylum-venv/bin/activate"
14+
if [ "$(docker ps -a -q -f name=asylum_dev)" == "" ]
15+
then
16+
echo "First run"
17+
set -x
18+
docker run --name asylum_dev -i -p 8000:8000 -p 1080:1080 -v `pwd -P`/project:/opt/asylum asylum_dev
19+
set +x
20+
else
21+
set -x
22+
docker start -i asylum_dev
23+
set +x
24+
fi

docker/run_unit_tests.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash -e
2+
SCRIPTDIR=$(python -c 'import os,sys;print os.path.dirname(os.path.realpath(sys.argv[1]))' "$0")
3+
4+
# Make sure we're in the correct place relative to Dockerfile no matter where we were called from
5+
cd `dirname "$SCRIPTDIR"`
26

37
docker build -t asylum_test .
48
docker run --rm --name asylum_test -it asylum_test ./run_tests.sh

docker/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ cd `dirname "$SCRIPTDIR"`
66

77
docker build -t asylum_test .
88
echo "Starting test server."
9-
echo "To connect to shell in this instance run: docker exec -it $(docker ps | grep asylum_test | awk '{print $1}') /bin/bash"
9+
echo "To connect to shell in this instance run: docker exec -it asylum_test /bin/bash"
1010
echo "Then in that shell run: source ../asylum-venv/bin/activate"
1111
docker run --rm --name asylum_test -it -p 8000:8000 -p 1080:1080 asylum_test

project/access/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class Meta:
1818
verbose_name_plural = _('Token Types')
1919
ordering = ['label', ]
2020

21+
2122
revisions.default_revision_manager.register(TokenType)
2223

2324

@@ -43,6 +44,7 @@ class Meta:
4344
unique_together = ("ttype", "value")
4445
ordering = ['owner__lname', 'owner__fname', 'ttype__label']
4546

47+
4648
revisions.default_revision_manager.register(Token)
4749

4850

@@ -59,6 +61,7 @@ class Meta:
5961
verbose_name_plural = _('Access Types')
6062
ordering = ['label', ]
6163

64+
6265
revisions.default_revision_manager.register(AccessType)
6366

6467

@@ -76,6 +79,7 @@ class Meta:
7679
unique_together = ('owner', 'atype')
7780
ordering = ['owner__lname', 'owner__fname', 'atype__label']
7881

82+
7983
revisions.default_revision_manager.register(Grant)
8084

8185

@@ -104,4 +108,5 @@ class Meta:
104108
unique_together = ("ttype", "value")
105109
ordering = ['contact', 'ttype__label']
106110

111+
107112
revisions.default_revision_manager.register(NonMemberToken)

project/bower.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
"dependencies": {
1111
"bootstrap": "3.3.5",
1212
"font-awesome": "~4.4.0",
13-
"jquery": "~2.1.4",
14-
"jquery.scrollTo": "~2.1.2",
15-
"scrollreveal": "scroll-reveal#~2.3.2",
16-
"vide": "~0.4.1"
13+
"jquery": "~2.1.4"
1714
}
1815
}

project/config/wsgi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515
1616
"""
1717
import os
18+
1819
import environ
20+
from django.core.wsgi import get_wsgi_application
21+
from whitenoise.django import DjangoWhiteNoise
22+
1923
ROOT_DIR = environ.Path(__file__) - 2 # (/a/b/myfile.py - 3 = /)
2024
env = environ.Env()
2125
# If the project root contains a .env file, read it
2226
if os.path.isfile(str(ROOT_DIR + '.env')):
2327
environ.Env.read_env(str(ROOT_DIR + '.env'))
2428

2529

26-
from django.core.wsgi import get_wsgi_application
27-
from whitenoise.django import DjangoWhiteNoise
2830

2931
if env.bool('USE_SENTRY', False):
3032
from raven.contrib.django.raven_compat.middleware.wsgi import Sentry

project/creditor/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Meta:
2727
verbose_name_plural = _('Transaction Tags')
2828
ordering = ['label', ]
2929

30+
3031
revisions.default_revision_manager.register(TransactionTag)
3132

3233

@@ -56,6 +57,7 @@ class Meta:
5657
verbose_name_plural = _('Transactions')
5758
ordering = ['-stamp', 'reference']
5859

60+
5961
revisions.default_revision_manager.register(Transaction)
6062

6163

@@ -155,4 +157,5 @@ class Meta:
155157
verbose_name_plural = _('Recurring Transactions')
156158
ordering = ['owner__lname', 'owner__fname', '-start']
157159

160+
158161
revisions.default_revision_manager.register(RecurringTransaction)

project/docker-entrypoint.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@ VENV_DIR_PATH=/opt/asylum-venv/
1313

1414
# make sure postgresql is running
1515
sudo -u postgres service postgresql start
16+
set +e
17+
export PGPASSWORD=asylum; while true; do psql -q asylum -c 'SELECT 1;' 1>/dev/null 2>&1 ; if [ "$?" -ne "0" ]; then echo "Waiting for psql"; sleep 1; else break; fi; done
18+
set -e
1619

1720
# Start forego or execute a command in the virtualenv
1821
if [ "$#" -eq 0 ]; then
22+
echo "Starting devel server"
1923
maildump --http-ip 0.0.0.0 -p ~/maildump.pid &
2024
npm run build
2125
npm run watch &
2226
NPM=$!
2327
./manage.py runserver 0.0.0.0:8000
2428
maildump -p ~/maildump.pid --stop
2529
else
30+
echo "Calling $@"
2631
"$@"
2732
fi

0 commit comments

Comments
 (0)