Skip to content

Commit

Permalink
latest manager version
Browse files Browse the repository at this point in the history
  • Loading branch information
leoBitto committed Mar 9, 2024
1 parent a23105e commit ba99921
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 18 deletions.
3 changes: 0 additions & 3 deletions config/.env.db

This file was deleted.

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ services:
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./config/.env.db
- ./config/.env

nginx:
build: ./nginx
volumes:
- static_volume:/home/app/web/static
- media_volume:/home/app/web/media
ports:
- 8000:80
- 80:80
depends_on:
- web

Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ plugins:
title: DjangoForge - docs
description: A ready to deploy Django project
logo: "./assets/img/DjangoForge.png"
favicon: "./assets/img/48djangoForge.ico"
favicon: "./assets/img/djangoforgeico.svg"
Binary file removed docs/assets/img/16DjangoForge.ico
Binary file not shown.
Binary file removed docs/assets/img/48DjangoForge.ico
Binary file not shown.
Binary file modified docs/assets/img/DjangoForge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/assets/img/djangoforgeico.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 14 additions & 6 deletions manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Questa funzione elimina le immagini precedenti e avvia i container
build_and_start_containers() {
# Stop tutti i container, incluso i volumi e quelli orfani
# Elimina i container e i volumi esistenti (opzionale)
sudo docker-compose down -v --remove-orphans

# Avvia i container Docker in background e ricrea le immagini se necessario
Expand All @@ -26,9 +26,6 @@ build_and_start_containers() {

# Questa funzione avvia solo i container Docker
start_containers() {
# Stop tutti i container, incluso i volumi e quelli orfani
sudo docker-compose down -v --remove-orphans

# Avvia i container Docker in background
sudo docker-compose -f docker-compose.yml up -d
echo "Immagini create"
Expand All @@ -47,11 +44,19 @@ start_containers() {
# Questa funzione ferma i container Docker
stop_containers() {
# Ferma tutti i container precedenti
sudo docker-compose down -v --remove-orphans
sudo docker-compose -f docker-compose.yml down

echo "Server fermato"
}

# Questa funzione elimina tutti i container e i volumi
destroy_containers() {
# Elimina tutti i container e i volumi associati
sudo docker-compose -f docker-compose.yml down -v --remove-orphans

echo "Container e volumi eliminati"
}

# Controlla gli argomenti passati allo script
case "$1" in
build)
Expand All @@ -63,8 +68,11 @@ case "$1" in
stop)
stop_containers
;;
destroy)
destroy_containers
;;
*)
echo "Utilizzo: $0 {build|start|stop}"
echo "Utilizzo: $0 {build|start|stop|destroy}"
exit 1
;;
esac
5 changes: 4 additions & 1 deletion nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM nginx:1.25

RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d
COPY nginx.conf /etc/nginx/conf.d
# Leggi la variabile d'ambiente DOMAIN dal file .env e sostituisci nel file di configurazione Nginx
RUN sed -i "s/\$DOMAIN/$(grep DOMAIN ../config/.env | cut -d '=' -f2)/" /etc/nginx/conf.d/nginx.conf

1 change: 1 addition & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ upstream base {
server {

listen 80;
server_name ${DOMAIN};

location / {
proxy_pass http://base;
Expand Down
8 changes: 4 additions & 4 deletions src/base/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
DATABASES = {
"default": {
"ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"),
"NAME": os.environ.get("SQL_DATABASE", BASE_DIR / "db.sqlite3"),
"USER": os.environ.get("SQL_USER", "user"),
"PASSWORD": os.environ.get("SQL_PASSWORD", "password"),
"NAME": os.environ.get("POSTGRES_DB", BASE_DIR / "db.sqlite3"),
"USER": os.environ.get("POSTGRES_USER", "user"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD", "password"),
"HOST": os.environ.get("SQL_HOST", "localhost"),
"PORT": os.environ.get("SQL_PORT", "5432"),
}
Expand Down Expand Up @@ -126,7 +126,7 @@

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Rome'

USE_I18N = True

Expand Down
2 changes: 1 addition & 1 deletion src/website/templates/website/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<!-- modal for messages -->
{% if messages %}
<div class="alert alert-info alert-dismissible fade show position-fixed bottom-0 end-0 m-4" role="alert">
<div class="alert {% if message.tags == 'error' %}alert-danger{% else %}alert-info{% endif %} alert-dismissible fade show position-fixed bottom-0 end-0 m-4 z-index-3" role="alert">
{% for message in messages %}
{{ message }}
{% if not forloop.last %}<br>{% endif %}
Expand Down

0 comments on commit ba99921

Please sign in to comment.