Skip to content
Snippets Groups Projects
Commit 0d9f9aa9 authored by Matteo Parrucci's avatar Matteo Parrucci
Browse files

vscode and oter things

parent 6d9a0a75
No related branches found
No related tags found
No related merge requests found
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"dockerComposeFile": ["docker-compose.yml", "docker-compose.dev.yml"],
"service": "backend",
"workspaceFolder": "/code/",
"extensions": ["ms-python.python",
"ms-vscode.atom-keybindings",
"mrorz.language-gettext",
"ms-python.vscode-pylance",
"batisteo.vscode-django",
"keno.uikit-3-snippets",
"dbaeumer.vscode-eslint",
"christian-kohler.npm-intellisense"]
}
......@@ -168,3 +168,5 @@ api/places365/*.tar.gz
media*
protected_media
librephotos
vscode/server-extensions
vscode/server-insiders-extensions
......@@ -15,9 +15,11 @@ RUN curl -SL https://download.pytorch.org/models/resnet152-b121ed2d.pth -o /root
RUN pip install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
# actual project
ARG DEBUG
WORKDIR /code
RUN git clone https://github.com/parruc/librephotos .
RUN pip install -r requirements.txt
RUN if [ "$DEBUG" = 1 ] ; then pip install -r requirements.dev.txt ; fi
RUN python -m spacy download en_core_web_sm
EXPOSE 8001
......
#! /bin/bash
export PYTHONUNBUFFERED=TRUE
pip install djangorestframework-simplejwt==4.6.0
mkdir -p /logs
python image_similarity/main.py 2>&1 | tee /logs/gunicorn_image_similarity.log &
......@@ -14,8 +13,12 @@ python manage.py createadmin -u $ADMIN_USERNAME $ADMIN_EMAIL 2>&1 | tee /logs/co
echo "Running backend server..."
python manage.py rqworker default 2>&1 | tee /logs/rqworker.log &
if [ $(ps -ef | grep -c "myApplication") -eq 1 ]; then echo "true"; fi
[ "$DEBUG" = 1 ] && RELOAD="--reload" || RELOAD=""
gunicorn --worker-class=gevent --timeout $WORKER_TIMEOUT $RELOAD --bind backend:8001 --log-level=info ownphotos.wsgi 2>&1 | tee /logs/gunicorn_django.log
if [ "$DEBUG" = 1 ]
then
echo "develompent backend starting"
gunicorn --worker-class=gevent --timeout 36000 --reload --bind backend:8001 --log-level=info ownphotos.wsgi 2>&1 | tee /logs/gunicorn_django.log
else
echo "production backend starting"
gunicorn --worker-class=gevent --timeout 3600 --bind backend:8001 --log-level=warning ownphotos.wsgi 2>&1
fi
......@@ -28,11 +28,14 @@ services:
backend:
tty: true
stdin_open: true
environment:
- DEBUG=1
build:
context: .
dockerfile: backend/Dockerfile
args:
DEBUG: 1
volumes:
- ./backend/entrypoint.sh:/entrypoint.sh
- ${myPhotos}:/data
......@@ -40,6 +43,9 @@ services:
- ${logLocation}:/logs
- ${codedir}/backend:/code
- ${cachedir}:/root/.cache
- ./vscode/server-extensions:/root/.vscode-server/extensions
- ./vscode/server-insiders-extensions:/root/.vscode-server-insiders/extensions
- ./vscode/settings.json:/code/.vscode/settings.json
pgadmin:
image: dpage/pgadmin4
......
......@@ -14,6 +14,8 @@ services:
restart: always
volumes:
- ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro
- ${myPhotos}:/data
- ${proMedia}:/protected_media
ports:
- ${httpPort}:80
depends_on:
......@@ -69,7 +71,6 @@ services:
- MAPBOX_API_KEY=${mapApiKey}
- TIME_ZONE=${timeZone}
- WEB_CONCURRENCY=${gunniWorkers}
- WORKER_TIMEOUT=${workerTimeOut}
- SKIP_PATTERNS=${skipPatterns}
- DEBUG=0
......
......@@ -4,14 +4,15 @@ echo "installing frontend"
npm install
echo "serving frontend"
[ "$DEBUG" = 1 ] then:
if [ "$DEBUG" = 1 ]
then
echo "develompent running frontend"
npm run start
else:
else
echo "production building frontend"
npm install -g serve
npm run build
echo "productions running frontend"
serve build -d -l 3000
fi
# DANGEROUSLY_DISABLE_HOST_CHECK=true HOST=0.0.0.0 npm start
\ No newline at end of file
......@@ -69,6 +69,3 @@ dbPass=AaAa1234
# You’ll want to vary this a bit to find the best for your particular workload.
# Each worker needs 800MB of RAM. Change at your own will. Default is 2.
gunniWorkers=2
# Gunicorn worker timeout seconds (ensure that one bad request doesn't stall other requests forever)
workerTimeOut=1800
......@@ -18,12 +18,28 @@ http {
proxy_set_header Host $host;
proxy_pass http://frontend:3000/;
}
location /api {
location ~ ^/(api|media)/ {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
include uwsgi_params;
proxy_pass http://backend:8001;
}
# Django media
location /protected_media {
internal;
alias /protected_media/;
}
# Original Photos
location /original {
internal;
alias /data/;
}
# Nextcloud Original Photos
location /nextcloud_original {
internal;
alias /data/nextcloud_media/;
}
}
}
{
"files.exclude": {
"**/*.py[co]": true,
"**/*.so": true,
"**/__pycache__": true
},
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": [
"--exclude: .+/migrations/",
"--max-line-length=119"
],
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"-d",
"E0239",
"-d",
"C0111"
],
"python.linting.pylintEnabled": true,
"python.sortImports.path": "isort"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment