Skip to content

Commit 496f7f3

Browse files
committed
Align configuration with SCIO
Also bump version. Use Djnago settings by default. Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent f6927b0 commit 496f7f3

File tree

8 files changed

+133
-65
lines changed

8 files changed

+133
-65
lines changed

.dockerignore

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
1-
.git
2-
.github
3-
4-
venv
1+
**/.git
2+
**/.gitignore
3+
**/.github
4+
**/.vscode
5+
**/.idea
6+
**/coverage
7+
**/.aws
8+
**/.ssh
9+
**/.DS_Store
10+
**/.aof
11+
**/venv
12+
**/env
13+
**/bin
14+
**/docs
15+
**/dist
16+
**/etc
17+
**/lib
18+
**/var
19+
**/*.egg-info
20+
.dockerignore
21+
.readthedocs.yaml
22+
docker.env
23+
CHANGELOG.rst
24+
Dockerfile
25+
README.rst
26+
docker-compose.yml
27+
pyvenv.cfg

.gitignore

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ __pycache__/
1111
build/
1212
develop-eggs/
1313
dist/
14-
downloads/
1514
eggs/
1615
.eggs/
1716
lib/
@@ -24,26 +23,20 @@ wheels/
2423
.installed.cfg
2524
*.egg
2625

27-
# PyInstaller
28-
# Usually these files are written by a python script from a template
29-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30-
*.manifest
31-
*.spec
3226

3327
# Installer logs
3428
pip-log.txt
3529
pip-delete-this-directory.txt
30+
pip-selfcheck.json
3631

3732
# Unit test / coverage reports
3833
htmlcov/
3934
.tox/
4035
.coverage
4136
.coverage.*
4237
.cache
43-
nosetests.xml
4438
coverage.xml
4539
*.cover
46-
.hypothesis/
4740

4841
# Translations
4942
*.mo
@@ -53,13 +46,6 @@ coverage.xml
5346
*.log
5447
local_settings.py
5548

56-
# Flask stuff:
57-
instance/
58-
.webassets-cache
59-
60-
# Scrapy stuff:
61-
.scrapy
62-
6349
# Sphinx documentation
6450
docs/_build/
6551

@@ -69,17 +55,10 @@ target/
6955
# Jupyter Notebook
7056
.ipynb_checkpoints
7157

72-
# pyenv
58+
# pyenv and pip
7359
.python-version
7460
pyvenv.cfg
7561
bin/
76-
pip-selfcheck.json
77-
78-
# celery beat schedule file
79-
celerybeat-schedule
80-
81-
# SageMath parsed files
82-
*.sage.py
8362

8463
# Environments
8564
.env
@@ -88,21 +67,10 @@ env/
8867
venv/
8968
ENV/
9069

91-
# Spyder project settings
92-
.spyderproject
93-
.spyproject
94-
95-
# Rope project settings
96-
.ropeproject
97-
98-
# mkdocs documentation
99-
/site
10070

10171
# mypy
10272
.mypy_cache/
10373

104-
# PyCharm
105-
.idea/
10674

10775
# Database
10876
*.sqlite3*
@@ -118,13 +86,13 @@ share
11886
Pipfile
11987

12088
# editors
121-
.vscode/
89+
.vscode
90+
# PyCharm
91+
.idea/
12292

12393
# pytest
12494
.pytest_cache
12595

126-
# VSCode
127-
.vscode
12896

12997
# Various junk and temp files
13098
.DS_Store

Dockerfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1+
# Copyright (c) nexB Inc. and others. All rights reserved.
2+
# VulnerableCode is a trademark of nexB Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects
8+
19
FROM python:3.8
210

3-
# Force unbuffered stdout and stderr (i.e. they are flushed to terminal immediately)
11+
12+
WORKDIR /app
13+
14+
# Python settings: Force unbuffered stdout and stderr (i.e. they are flushed to terminal immediately)
415
ENV PYTHONUNBUFFERED 1
16+
# Python settings: do not write pyc files
17+
ENV PYTHONDONTWRITEBYTECODE 1
18+
19+
RUN mkdir -p /var/vulnerablecode/static
20+
21+
# Keep the dependencies installation before the COPY of the app/ for proper caching
22+
COPY setup.cfg setup.py requirements.txt pyproject.toml /app/
23+
RUN pip install .
524

6-
RUN mkdir /opt/vulnerablecode && \
7-
mkdir -p /var/vulnerablecode/static/
8-
WORKDIR /opt/vulnerablecode
9-
COPY . .
10-
RUN python -m pip install --upgrade pip && \
11-
pip install -r requirements.txt
25+
COPY . /app

docker-compose.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,45 @@
1-
version: '3'
1+
version: "3"
22

33
services:
44
db:
5-
image: postgres
5+
image: postgres:13
66
env_file:
77
- docker.env
88
volumes:
99
- db_data:/var/lib/postgresql/data/
1010

11-
vulnerablecode:
11+
web:
1212
build: .
1313
command: /bin/sh -c "
14-
./manage.py migrate &&
15-
./manage.py collectstatic --no-input --clear &&
16-
gunicorn vulnerablecode.wsgi:application -u nobody -g nogroup --bind :8000 --timeout 600 --workers 2"
14+
./manage.py migrate &&
15+
./manage.py collectstatic --no-input --verbosity 0 --clear &&
16+
gunicorn vulnerablecode.wsgi:application -u nobody -g nogroup --bind :8000 --timeout 600 --workers 8"
1717
env_file:
1818
- docker.env
19+
expose:
20+
- 8000
1921
volumes:
22+
- /etc/vulnerablecode/:/etc/vulnerablecode/
2023
- static:/var/vulnerablecode/static/
2124
restart: on-failure
2225
depends_on:
2326
- db
2427

2528
nginx:
2629
image: nginx
30+
ports:
31+
- 80:80
32+
- 443:443
2733
env_file:
2834
- docker.env
2935
volumes:
36+
- ./etc/nginx/conf.d/:/etc/nginx/conf.d/
3037
- static:/var/vulnerablecode/static/
31-
- ./etc/nginx/templates/:/etc/nginx/templates/
32-
ports:
33-
- ${NGINX_PORT:-8000}:80
3438
depends_on:
35-
- vulnerablecode
39+
- web
3640

3741

3842
volumes:
39-
static:
4043
db_data:
44+
static:
4145

docker.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@ POSTGRES_DB=vulnerablecode
22
POSTGRES_USER=vulnerablecode
33
POSTGRES_PASSWORD=vulnerablecode
44

5-
DJANGO_SETTINGS_MODULE=vulnerablecode.settings
65
VULNERABLECODE_DB_HOST=db
76
VULNERABLECODE_STATIC_ROOT=/var/vulnerablecode/static/
8-
9-
GUNICORN_SERVER=vulnerablecode

etc/nginx/conf.d/default.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
upstream gunicorn_app {
2-
server vulnerablecode:8000;
2+
server web:8000;
33
}
44

55
server {

vulnerablecode/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4+
# The VulnerableCode software is licensed under the Apache License version 2.0.
5+
# Data generated with VulnerableCode require an acknowledgment.
6+
#
7+
# You may not use this software except in compliance with the License.
8+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software distributed
10+
# under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR
11+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
# specific language governing permissions and limitations under the License.
13+
#
14+
# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode
15+
# derivative work, you must accompany this data with the following acknowledgment:
16+
#
17+
# Generated with VulnerableCode and provided on an 'AS IS' BASIS, WITHOUT WARRANTIES
18+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19+
# VulnerableCode should be considered or used as legal advice. Consult an Attorney
20+
# for any legal advice.
21+
# VulnerableCode is a free software from nexB Inc. and others.
22+
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
23+
24+
import os
25+
import sys
26+
import warnings
27+
from pathlib import Path
28+
29+
__version__ = "30.0.0"
30+
31+
32+
def command_line():
33+
"""
34+
Command line entry point.
35+
"""
36+
from django.core.management import execute_from_command_line
37+
38+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vulnerablecode.settings")
39+
execute_from_command_line(sys.argv)

vulnerablecode/wsgi.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# http://nexb.com and https://github.com/nexB/vulnerablecode/
4+
# The VulnerableCode software is licensed under the Apache License version 2.0.
5+
# Data generated with VulnerableCode require an acknowledgment.
6+
#
7+
# You may not use this software except in compliance with the License.
8+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software distributed
10+
# under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR
11+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
# specific language governing permissions and limitations under the License.
13+
#
14+
# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode
15+
# derivative work, you must accompany this data with the following acknowledgment:
16+
#
17+
# Generated with VulnerableCode and provided on an 'AS IS' BASIS, WITHOUT WARRANTIES
18+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
19+
# VulnerableCode should be considered or used as legal advice. Consult an Attorney
20+
# for any legal advice.
21+
# VulnerableCode is a free software from nexB Inc. and others.
22+
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
23+
124
"""
2-
WSGI config for hola project.
25+
WSGI config for VulnerableCode project.
326
427
It exposes the WSGI callable as a module-level variable named ``application``.
528
629
For more information on this file, see
7-
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
30+
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
831
"""
932

1033
import os

0 commit comments

Comments
 (0)