Skip to content

Commit

Permalink
Merge pull request #285 from inbo/development
Browse files Browse the repository at this point in the history
Development -> main
  • Loading branch information
mainlyIt authored Jan 3, 2025
2 parents d5f4162 + 599757b commit 5abb588
Show file tree
Hide file tree
Showing 16 changed files with 1,114 additions and 587 deletions.
14 changes: 12 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ echo "Load waarnemingen observation data via: python manage.py load_waarnemingen

# Start Gunicorn
echo "Starting Gunicorn..."
gunicorn --workers 3 --bind 0.0.0.0:8000 vespadb.wsgi:application &

gunicorn --workers 3 \
--worker-class gthread \
--threads 4 \
--worker-connections 1000 \
--timeout 1800 \
--graceful-timeout 300 \
--keep-alive 65 \
--max-requests 1000 \
--max-requests-jitter 50 \
--bind 0.0.0.0:8000 \
vespadb.wsgi:application &

# Wait for Gunicorn to start
sleep 5

Expand Down
71 changes: 66 additions & 5 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
worker_processes 1;
worker_processes auto; # Changed from 1 to auto for better performance

events {
worker_connections 1024;
worker_connections 4096;
multi_accept on;
use epoll;
}

http {
include mime.types;
default_type application/octet-stream;

# HTTP/2 specific settings
http2_max_field_size 16k;
http2_max_header_size 32k;
http2_max_requests 1000;
http2_idle_timeout 5m;

# Global timeout settings
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 1800;
send_timeout 600;
keepalive_timeout 650;

sendfile on;
keepalive_timeout 65;
tcp_nopush on;
tcp_nodelay on;

# Buffering settings for large responses
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
proxy_max_temp_file_size 0;

server {
listen 80;
listen 80 http2;
server_name uat.vespadb.be;

# Increase client body size limit
client_max_body_size 0; # Disabled limit for large files

location /static/ {
alias /workspaces/vespadb/collected_static/;
}
Expand All @@ -29,13 +55,32 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# HTTP/2 specific
proxy_http_version 1.1;
proxy_set_header Connection "";

# Timeouts
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 1800s;

# Buffer settings for large files
proxy_buffering on;
proxy_request_buffering on;
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
}
}

server {
listen 80;
listen 80 http2;
server_name data.vespawatch.be;

# Increase client body size limit
client_max_body_size 0; # Disabled limit for large files

location /static/ {
alias /workspaces/vespadb/collected_static/;
}
Expand All @@ -50,6 +95,22 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# HTTP/2 specific
proxy_http_version 1.1;
proxy_set_header Connection "";

# Timeouts
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 1800s;

# Buffer settings for large files
proxy_buffering on;
proxy_request_buffering on;
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
}
}
}
783 changes: 412 additions & 371 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ types-python-dateutil = "^2.9.0.20240316"

whitenoise = "^6.6.0"
django-ses = "^4.2.0"
tenacity = "^9.0.0"
django-extensions = "^3.2.3"
[tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/
coverage = { extras = ["toml"], version = ">=7.4.1" }
ipython = ">=8.20.0"
Expand Down
12 changes: 6 additions & 6 deletions src/components/FilterComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
{ name: 'Zichtbaar', value: true },
{ name: 'Niet zichtbaar', value: false }
]);
const minDate = ref(new Date(new Date().getFullYear(), 3, 1));
const minDate = ref(new Date(2024, 3, 1));
const maxDate = ref(null);
const selectedObservationStart = ref(false);
const selectedObservationEnd = ref(false);
Expand All @@ -121,7 +121,7 @@ export default {
max_observation_date: maxDateCET,
visible: visibleActief.value
});
}, 300);
const toggleMenu1 = () => {
Expand Down Expand Up @@ -156,11 +156,11 @@ export default {
watch([selectedMunicipalities, selectedProvinces, selectedNestType, selectedNestStatus, anbAreasActief, selectedObservationStart, selectedObservationEnd, visibleActief], () => {
emitFilterUpdate();
}, { deep: true});
}, { deep: true });
watch(() => vespaStore.filters, (newFilters, oldFilters) => {
const hasChanged = JSON.stringify(newFilters) !== JSON.stringify(oldFilters);
if (hasChanged) {
selectedMunicipalities.value = newFilters.municipalities || [];
selectedProvinces.value = newFilters.provinces || [];
Expand All @@ -178,7 +178,7 @@ export default {
anbAreasActief.value = vespaStore.filters.anbAreasActief;
selectedNestType.value = vespaStore.filters.nestType || [];
selectedNestStatus.value = vespaStore.filters.nestStatus || [];
minDate.value = vespaStore.filters.min_observation_date ? new Date(vespaStore.filters.min_observation_date) : new Date(new Date().getFullYear(), 3, 1);
minDate.value = vespaStore.filters.min_observation_date ? new Date(vespaStore.filters.min_observation_date) : new Date(2024, 3, 1);
maxDate.value = vespaStore.filters.max_observation_date ? new Date(vespaStore.filters.max_observation_date) : null;
if (!vespaStore.municipalitiesFetched) await vespaStore.fetchMunicipalities();
if (!vespaStore.provincesFetched) await vespaStore.fetchProvinces();
Expand Down
5 changes: 5 additions & 0 deletions src/components/MapPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<div class="loading-screen" v-if="isMapLoading">
Observaties laden...
</div>
<div class="loading-screen" v-if="isExporting">
Exporteren...
</div>
<div class="map-legend" v-if="map && !isMapLoading">
<div>
<span class="legend-icon bg-reported"></span> Gerapporteerd nest
Expand Down Expand Up @@ -61,6 +64,7 @@ export default {
setup() {
const vespaStore = useVespaStore();
const searchQuery = ref('');
const isExporting = computed(() => vespaStore.isExporting);
const router = useRouter();
const selectedObservation = computed(() => vespaStore.selectedObservation);
const isEditing = computed(() => vespaStore.isEditing);
Expand Down Expand Up @@ -327,6 +331,7 @@ export default {
updateMarkerColor,
searchQuery,
searchAddress,
isExporting,
};
},
};
Expand Down
25 changes: 21 additions & 4 deletions src/components/NavbarComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@
Export
</button>
<ul class="dropdown-menu">
<li><button class="dropdown-item" @click="exportData('csv')">CSV</button></li>
<li>
<button
class="dropdown-item"
@click="exportData('csv')"
:disabled="isExporting"
>
CSV
</button>
</li>
</ul>
</div>

Expand Down Expand Up @@ -67,6 +75,7 @@ export default {
const isModalVisible = ref(false);
const modalTitle = ref('');
const modalMessage = ref('');
const isExporting = computed(() => vespaStore.isExporting);
watch(() => vespaStore.error, (newError) => {
if (newError) {
Expand Down Expand Up @@ -94,10 +103,18 @@ export default {
};
const exportData = async (format) => {
await vespaStore.exportData(format);
};
try {
if (vespaStore.isExporting) return;
await vespaStore.exportData(format);
} catch (error) {
modalTitle.value = 'Error';
modalMessage.value = 'Er is een fout opgetreden tijdens het exporteren.';
isModalVisible.value = true;
}
};
return { isLoggedIn, loadingAuth, username, logout, navigateToChangePassword, exportData, fileInput, isModalVisible, modalTitle, modalMessage };
return { isLoggedIn, loadingAuth, username, logout, navigateToChangePassword, exportData, fileInput, isModalVisible, modalTitle, modalMessage, isExporting };
},
mounted() {
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'));
Expand Down
54 changes: 20 additions & 34 deletions src/components/ObservationDetailsComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,53 +205,42 @@
<span class="visually-hidden">Volgende</span>
</button>
</div>

<div class="row mb-2">
<label class="col-4 col-form-label">Type</label>
<div class="col-8">
<select v-if="selectedObservation.nest_type !== undefined"
v-model="editableObservation.nest_type" class="form-select"
:disabled="!canEdit">
<option :value="null">Geen</option>
<option v-for="(label, value) in nestTypeEnum" :key="value" :value="value">{{
label }}</option>
</select>
<p class="form-control-plaintext">
{{ selectedObservation.nest_type ? nestTypeEnum[selectedObservation.nest_type] :
'Geen' }}
</p>
</div>
</div>
<div class="row mb-2">
<label class="col-4 col-form-label">Locatie</label>
<div class="col-8">
<select v-if="selectedObservation.nest_location !== undefined"
v-model="editableObservation.nest_location" class="form-select"
:disabled="!canEdit">
<option :value="null">Geen</option>
<option v-for="(label, value) in nestLocationEnum" :key="value" :value="value">
{{ label }}</option>
</select>
<p class="form-control-plaintext">
{{ selectedObservation.nest_location ?
nestLocationEnum[selectedObservation.nest_location] :
'Geen' }}
</p>
</div>
</div>
<div class="row mb-2">
<label class="col-4 col-form-label">Grootte</label>
<div class="col-8">
<select v-if="selectedObservation.nest_size !== undefined"
v-model="editableObservation.nest_size" class="form-select"
:disabled="!canEdit">
<option :value="null">Geen</option>
<option v-for="(label, value) in nestSizeEnum" :key="value" :value="value">{{
label }}</option>
</select>
<p class="form-control-plaintext">
{{ selectedObservation.nest_size ? nestSizeEnum[selectedObservation.nest_size] :
'Geen' }}
</p>
</div>
</div>
<div class="row mb-2">
<label class="col-4 col-form-label">Hoogte</label>
<div class="col-8">
<select v-if="selectedObservation.nest_height !== undefined"
v-model="editableObservation.nest_height" class="form-select"
:disabled="!canEdit">
<option :value="null">Geen</option>
<option v-for="(label, value) in nestHeightEnum" :key="value" :value="value">{{
label }}</option>
</select>
<p class="form-control-plaintext">
{{ selectedObservation.nest_height ?
nestHeightEnum[selectedObservation.nest_height] :
'Geen' }}
</p>
</div>
</div>
<div class="row mb-2">
Expand Down Expand Up @@ -322,7 +311,8 @@
<div class="row mb-2">
<label class="col-4 col-form-label">Telefoon</label>
<div class="col-8">
<p class="form-control-plaintext">{{ selectedObservation.observer_phone_number }}</p>
<p class="form-control-plaintext">{{ selectedObservation.observer_phone_number }}
</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -498,10 +488,6 @@ export default {
};
const editableFields = [
"nest_height",
"nest_size",
"nest_location",
"nest_type",
"observation_datetime",
"eradication_date",
"admin_notes",
Expand Down
Loading

0 comments on commit 5abb588

Please sign in to comment.