Skip to content

Commit 6268b5a

Browse files
committed
Added tar option
Added dev docker Added docker-compose.dev.yml
1 parent f007d30 commit 6268b5a

7 files changed

Lines changed: 75 additions & 30 deletions

File tree

.env.sample

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ ELN_URL=https://XXXXXXXX
44
DJANGO_SUPERUSER_USERNAME=Tom Riple
55
DJANGO_SUPERUSER_EMAIL=taent.riple@kit.edu
66
DJANGO_SUPERUSER_PASSWORD=QWer!1234
7-
DJANGO_POSTGRES_NAME=bridge
8-
DJANGO_POSTGRES_USER=postgres
9-
DJANGO_POSTGRES_PASSWORD=QWer!1234
7+
POSTGRES_NAME=bridge
8+
POSTGRES_USER=postgres
9+
POSTGRES_PASSWORD=QWer!1234
10+
PROJECT_POSTGRES_PORT=65432
11+
PROJECT_WEB_PORT=3222

ShuttleBuilder/settings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@
107107
if not DEBUG:
108108
DATABASES_AVAILABLE['default'] = {
109109
'ENGINE': 'django.db.backends.postgresql',
110-
'NAME': os.environ.get('DJANGO_POSTGRES_NAME', 'bridge'),
111-
'USER': os.environ.get('DJANGO_POSTGRES_USER', 'postgres'),
112-
'PASSWORD': os.environ.get('DJANGO_POSTGRES_PASSWORD'),
113-
'HOST': os.environ.get('DJANGO_POSTGRES_HOST', 'localhost'),
114-
'PORT': os.environ.get('DJANGO_POSTGRES_PORT', '5432'),
110+
'NAME': os.environ.get('POSTGRES_NAME', 'bridge'),
111+
'USER': os.environ.get('POSTGRES_USER', 'postgres'),
112+
'PASSWORD': os.environ.get('POSTGRES_PASSWORD'),
113+
'HOST': os.environ.get('POSTGRES_HOST', 'localhost'),
114+
'PORT': os.environ.get('POSTGRES_PORT', '5432'),
115115
}
116116

117117
database = os.environ.get('DJANGO_DATABASE', 'default')

docker-compose.dev.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3'
2+
services:
3+
db:
4+
image: postgres:13
5+
restart: unless-stopped
6+
hostname: db
7+
expose:
8+
- 5432
9+
ports:
10+
- ${DJANGO_POSTGRES_PORT:-65432}:5432
11+
environment:
12+
- POSTGRES_USER=${POSTGRES_USER}
13+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
14+
- POSTGRES_DB=${POSTGRES_NAME}
15+
env_file:
16+
- ./.env
17+
volumes:
18+
- bridge_db:/var/lib/postgresql/data/
19+
web:
20+
build:
21+
context: .
22+
image: mstarman/shuttlebuilder:0.2.3
23+
depends_on:
24+
- db
25+
environment:
26+
- POSTGRES_PORT=5432
27+
- POSTGRES_HOST=db
28+
env_file:
29+
- ./.env
30+
ports:
31+
- 3222:80
32+
volumes:
33+
bridge_db:

docker-compose.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
version: '3'
1+
version: '3.7'
2+
3+
x-postgress-variables: &postgress-variables
4+
POSTGRES_NAME: "${POSTGRES_NAME:-postgres}"
5+
POSTGRES_USER: "${POSTGRES_USER:-postgres}"
6+
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-q3opc3123§§!'urbn$5(#6}"
7+
8+
x-envs: &envs
9+
MODE: prod
10+
ALLOWED_HOST: "${ALLOWED_HOST}"
11+
ELN_URL: "${ELN_URL}"
12+
DJANGO_SUPERUSER_USERNAME: "${DJANGO_SUPERUSER_USERNAME}"
13+
DJANGO_SUPERUSER_EMAIL: "${DJANGO_SUPERUSER_EMAIL}"
14+
DJANGO_SUPERUSER_PASSWORD: "${DJANGO_SUPERUSER_PASSWORD}"
15+
POSTGRES_PORT: 5432
16+
POSTGRES_HOST: db
17+
218
services:
319
db:
420
image: postgres:13
@@ -7,27 +23,19 @@ services:
723
expose:
824
- 5432
925
ports:
10-
- ${DJANGO_POSTGRES_PORT:-65432}:5432
26+
- ${PROJECT_POSTGRES_PORT:-65432}:5432
1127
environment:
12-
- POSTGRES_USER=${DJANGO_POSTGRES_USER}
13-
- POSTGRES_PASSWORD=${DJANGO_POSTGRES_PASSWORD}
14-
- POSTGRES_DB=${DJANGO_POSTGRES_NAME}
15-
env_file:
16-
- ./.env
28+
<<: *postgress-variables
1729
volumes:
1830
- bridge_db:/var/lib/postgresql/data/
1931
web:
20-
build:
21-
context: .
22-
image: mstarman/shuttlebuilder:0.2.1
32+
image: mstarman/shuttlebuilder:0.2.3
33+
restart: unless-stopped
2334
depends_on:
2435
- db
2536
environment:
26-
- DJANGO_POSTGRES_PORT=5432
27-
- DJANGO_POSTGRES_HOST=db
28-
env_file:
29-
- ./.env
37+
<<: [*envs, *postgress-variables]
3038
ports:
31-
- 3222:80
39+
- ${PROJECT_WEB_PORT:-80}:80
3240
volumes:
3341
bridge_db:

main_app/models.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __str__(self):
102102
return self.name
103103

104104
def get_path(self):
105-
folder_name = re.sub(r'[^a-zA-Z0-9]', '_',self.name)
105+
folder_name = re.sub(r'[^a-zA-Z0-9]', '_', self.name)
106106
file_paths = os.path.join('./projects/git_repos/', folder_name)
107107
new_repo = glob.glob(os.path.join(file_paths, '*'))
108108
if len(new_repo) > 0:
@@ -111,6 +111,7 @@ def get_path(self):
111111
new_repo = None
112112

113113
return (file_paths, new_repo)
114+
114115
@classmethod
115116
def get_active(self):
116117
try:
@@ -179,7 +180,8 @@ class ShuttleInstanceSearchForm(AbstractSearchForm):
179180
TYPE_CHOISES = (
180181
('file', _('File')),
181182
('folder', _('Folder')),
182-
('zip', _('ZIP'))
183+
('zip', _('ZIP')),
184+
('tar', _('TAR'))
183185
)
184186

185187
SYSTEM_CHOISES = (
@@ -199,7 +201,8 @@ class ShuttleInstance(models.Model, SdcModel):
199201
html_list_template = "main_app/models/ShuttleInstance/ShuttleInstance_list.html"
200202
html_detail_template = "main_app/models/ShuttleInstance/ShuttleInstance_details.html"
201203

202-
name = models.CharField(help_text=_('Unique name of the Shuttle instance. This name cannot be changed!'), max_length=50,
204+
name = models.CharField(help_text=_('Unique name of the Shuttle instance. This name cannot be changed!'),
205+
max_length=50,
203206
unique=True)
204207
user = models.CharField(help_text=_("WebDAV or STFP User"), max_length=50, default="")
205208
password = models.CharField(help_text=_("WebDAV or STFP Password"), max_length=100)
@@ -219,7 +222,7 @@ class ShuttleInstance(models.Model, SdcModel):
219222
<span style="margin-left: 30px;">[PROJECT_PATH]-Path (directory) within the LSDF</span>"""),
220223
max_length=255)
221224
shuttle_type = models.CharField(_('Type'), help_text=_(
222-
"Type must be 'file', 'folder' or 'zip'. The 'file' option means that each file is handled individually, the 'folder' option means that entire folders are transmitted only when all files in them are ready. The option 'zip' sends a folder zipped, only when all files in a folder are ready."),
225+
"Type must be 'file', 'folder', 'tar' or 'zip'. The 'file' option means that each file is handled individually, the 'folder' option means that entire folders are transmitted only when all files in them are ready. The options 'tar' ond/or 'zip' sends a folder zipped (or compressed as tar archieve), only when all files in a folder are ready."),
223226
max_length=255, choices=TYPE_CHOISES)
224227
duration = models.IntegerField(
225228
help_text=_("Duration in seconds, i.e., how long a file must not be changed before sent. (default 300 sec.)"),
@@ -233,7 +236,6 @@ class ShuttleInstance(models.Model, SdcModel):
233236
last_build = models.DateTimeField(null=True, blank=True)
234237
owner = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
235238

236-
237239
def __str__(self):
238240
return self.name
239241

main_app/templates/main_app/sdc/git_insatnce_edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="container">
1+
<div class="container position-relative">
22
<h2 class="page-header"><this.form_header></this.form_header></h2>
33

44
<form >

main_app/templates/main_app/sdc/git_instance_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="container">
1+
<div class="container position-relative">
22
<h3 class="page-header">List of all liked GIT repos</h3>
33
<div class="list-container">
44
</div>

0 commit comments

Comments
 (0)