+ python projects nginx example config and postgis and additional python server docker examples
This commit is contained in:
22
bash/python-restart.sh
Executable file
22
bash/python-restart.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)"
|
||||
|
||||
. $DIR/bash/_docker-cmd.sh || {
|
||||
echo "no docker cmd is presented" && exit 1
|
||||
}
|
||||
|
||||
PYTHON_SERVICE=$1
|
||||
|
||||
if [[ -z "${PYTHON_SERVICE}" ]]; then
|
||||
echo "Usage: $(basename $0) PYTHON_PROJECT_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONTAINER=$(docker ps | grep "python-${PYTHON_SERVICE}" | awk '{print $1}')
|
||||
|
||||
if [[ -z "${CONTAINER}" ]]; then
|
||||
echo "Unable to find container: db"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$DOCKER_CMD restart ${CONTAINER}
|
@ -22,7 +22,14 @@ server {
|
||||
|
||||
root $python_root;
|
||||
|
||||
location @media_proxy {
|
||||
proxy_pass $uploads_upstream;
|
||||
proxy_ssl_server_name on;
|
||||
}
|
||||
|
||||
location ~ /media {
|
||||
root $python_root;
|
||||
try_files $uri @media_proxy;
|
||||
expires max;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,19 @@ services:
|
||||
- ./hostfiles:/hostfiles
|
||||
ports:
|
||||
- "5432:5432"
|
||||
db-project:
|
||||
image: postgis/postgis:14-3.3
|
||||
environment:
|
||||
- POSTGRES_DB=project_db
|
||||
- POSTGRES_USER=project_db_user
|
||||
- POSTGRES_PASSWORD=project_db_password
|
||||
ports:
|
||||
- "5434:5432"
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready" ]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
databasepg:
|
||||
|
@ -13,4 +13,18 @@ services:
|
||||
python manage.py migrate
|
||||
&& python manage.py collectstatic
|
||||
&& uvicorn 'APP_NAME.asgi:application' --host 0.0.0.0
|
||||
"
|
||||
python-project:
|
||||
user: ${WORKSPACE_PUID}:${WORKSPACE_PGID}
|
||||
restart: always
|
||||
build:
|
||||
context: ${PYTHON_PROJECTS_DIR}/project
|
||||
volumes:
|
||||
- ${PYTHON_PROJECTS_DIR}/project:/code
|
||||
command: bash -c "
|
||||
cd src
|
||||
&& python manage.py compilemessages
|
||||
&& python manage.py collectstatic --clear --noinput
|
||||
&& python manage.py migrate
|
||||
&& uvicorn --reload app.asgi:application --host 0.0.0.0
|
||||
"
|
Reference in New Issue
Block a user