diff --git a/data/nginx/nginx.dev.conf b/data/nginx/nginx.dev.conf index 3f391830..b6bec79a 100644 --- a/data/nginx/nginx.dev.conf +++ b/data/nginx/nginx.dev.conf @@ -12,7 +12,7 @@ http { } upstream hmr { - server frontend:5174; + server frontend:443; } server { @@ -50,6 +50,14 @@ http { proxy_redirect off; } + location /hmr { + proxy_pass http://hmr; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + } + location / { proxy_pass http://frontend; @@ -58,18 +66,4 @@ http { proxy_redirect off; } } - - server { - listen 5174 ssl; - - ssl_certificate ssl/certificate.crt; - ssl_certificate_key ssl/private.key; - - location / { - proxy_pass http://hmr; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - } } diff --git a/development.sh b/development.sh index fdf0e030..9fb8f979 100755 --- a/development.sh +++ b/development.sh @@ -26,8 +26,7 @@ echo "Checking environment file..." if ! [ -f .env ]; then cp .dev.env .env - read -s -p "Enter a random string for the django secret (just smash keyboard): " new_secret - sed -i "s/^DJANGO_SECRET_KEY=.*/DJANGO_SECRET_KEY=$new_secret/" .env + sed -i "s/^DJANGO_SECRET_KEY=.*/DJANGO_SECRET_KEY=totally_random_key_string/" .env echo "Created environment file" fi @@ -65,7 +64,7 @@ if [ "$backend" = true ] && [ "$frontend" = true ]; then elif [ "$frontend" = true ]; then docker-compose -f development.yml logs --follow --tail 50 frontend else - docker-compose -f development.yml logs --follow --tail 50 backend + docker-compose -f development.yml logs --follow --tail 50 frontend fi echo "Cleaning up..." diff --git a/development.yml b/development.yml index dbce0f95..7a410115 100644 --- a/development.yml +++ b/development.yml @@ -37,10 +37,9 @@ services: - 80:80 - 443:443 - 8080:8080 - - 5174:5174 volumes: - - $DATA_DIR/nginx/nginx.dev.conf:/etc/nginx/nginx.conf:ro - - $SSL_DIR:/etc/nginx/ssl:ro + - ${DATA_DIR}/nginx/nginx.dev.conf:/etc/nginx/nginx.conf:ro + - ${SSL_DIR}:/etc/nginx/ssl:ro depends_on: - backend - frontend @@ -55,7 +54,7 @@ services: expose: - 8080 volumes: - - $BACKEND_DIR:/code + - ${BACKEND_DIR}:/code celery: <<: *common-keys-selab @@ -65,7 +64,7 @@ services: dockerfile: Dockerfile.dev command: celery -A ypovoli worker -l DEBUG volumes: - - $BACKEND_DIR:/code + - ${BACKEND_DIR}:/code depends_on: - backend - redis @@ -80,7 +79,7 @@ services: expose: - 5173 volumes: - - $FRONTEND_DIR:/app + - ${FRONTEND_DIR}:/app depends_on: - backend @@ -95,5 +94,5 @@ services: - $REDIS_PORT entrypoint: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru volumes: - - $DATADIR/redis:/data + - ${DATA_DIR}/redis:/data diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index ebf518d5..90fb59c4 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from 'vite' -import { resolve } from 'path'; import vue from '@vitejs/plugin-vue'; +import { resolve } from 'path'; +import { defineConfig } from 'vite'; // https://vitejs.dev/config/ export default defineConfig({ @@ -12,8 +12,17 @@ export default defineConfig({ } }, server: { + host: '0.0.0.0', + port: 5173, + proxy: { + '/hmr': { + target: 'ws://localhost:5173', + ws: true + }, + }, hmr: { - port: 5174 + path: "/hmr", + port: 443 } } }); diff --git a/production.yml b/production.yml index 40f93d81..3c475972 100644 --- a/production.yml +++ b/production.yml @@ -92,7 +92,7 @@ services: dockerfile: Dockerfile.prod command: celery -A ypovoli worker -l ERROR volumes: - - $BACKEND_DIR:/code + - ${BACKEND_DIR}:/code depends_on: - backend - redis