Skip to content

Commit c24bb8a

Browse files
authored
Merge pull request #27 from UniversalScientificTechnologies/fix/ci_tests_env
CI test .env setup, contribution setup guide update
2 parents 92b95a6 + 357006b commit c24bb8a

File tree

5 files changed

+51
-43
lines changed

5 files changed

+51
-43
lines changed

.env.example

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
# S3 Bucket
2-
AWS_ACCESS_KEY_ID=minioadmin
3-
AWS_SECRET_ACCESS_KEY=minioadmin
4-
AWS_STORAGE_BUCKET_NAME=dosportal-media
5-
AWS_S3_ENDPOINT_URL=http://minio:9000
6-
AWS_S3_REGION_NAME=us-east-1
7-
AWS_DEFAULT_ACL=public-read
8-
AWS_S3_CUSTOM_DOMAIN=
9-
AWS_S3_SIGNATURE_VERSION=s3v4
1+
# MinIO Storage
102
MINIO_ROOT_USER=minioadmin
113
MINIO_ROOT_PASSWORD=minioadmin
4+
MINIO_ACCESS_KEY=minioadmin
5+
MINIO_SECRET_KEY=minioadmin
6+
MINIO_BUCKET_NAME=dosportal-media
7+
MINIO_ENDPOINT_URL=http://minio:9000
8+
MINIO_PUBLIC_URL=http://localhost:8080/s3
9+
MINIO_REGION=us-east-1
10+
MINIO_BROWSER_REDIRECT_URL=http://localhost:8080/minio
1211

1312
# Django
1413
SECRET_KEY='django-insecure-)&9q7=6szljptu&2a11rq1k-ofhz1s$nxk&t+f=3xk74(vq4jq'
15-
CSRF_TRUSTED_ORIGINS='http://localhost:5173'
14+
SITE_URL=http://localhost:8080
15+
SITE_PORT=8080
16+
17+
# CORS
18+
CSRF_TRUSTED_ORIGINS=http://localhost:8080,http://127.0.0.1:8080,http://localhost:5173,http://127.0.0.1:5173
1619

1720
# Postgresql
1821
POSTGRES_DB=dosportal

.github/workflows/deploy.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
workflow_dispatch:
1212
inputs:
1313
environment:
14-
description: 'Environment to deploy'
14+
description: "Environment to deploy"
1515
required: true
1616
type: choice
1717
options:
@@ -37,6 +37,9 @@ jobs:
3737
- name: Build backend image
3838
run: docker compose -f docker-compose.yml build backend
3939

40+
- name: Create .env file for tests
41+
run: cp .env.example .env
42+
4043
- name: Start dependencies
4144
run: docker compose -f docker-compose.yml up -d db_dosportal redis minio
4245

@@ -87,7 +90,7 @@ jobs:
8790
IMAGE_TAG=""
8891
APP_DIR=""
8992
PROJECT_NAME=""
90-
93+
9194
# Release (tag or published release)
9295
if [[ "${{ github.event_name }}" == "release" || ( "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/v* ) ]]; then
9396
SHOULD_DEPLOY="true"
@@ -99,15 +102,15 @@ jobs:
99102
fi
100103
APP_DIR="/data/ust/dosportal/release"
101104
PROJECT_NAME="dosportal-release"
102-
105+
103106
# Master branch (master or dev)
104107
elif [[ "${{ github.event_name }}" == "push" && ( "${{ github.ref }}" == "refs/heads/master" || "${{ github.ref }}" == "refs/heads/dev" ) ]]; then
105108
SHOULD_DEPLOY="true"
106109
ENVIRONMENT="master"
107110
IMAGE_TAG="master"
108111
APP_DIR="/data/ust/dosportal/master"
109112
PROJECT_NAME="dosportal-master"
110-
113+
111114
# PR comment with /test-me
112115
elif [[ "${{ github.event_name }}" == "issue_comment" ]]; then
113116
if [[ "$COMMENT_BODY" == *"/test-me"* ]] && [[ "${{ github.event.issue.pull_request }}" != "" ]]; then
@@ -117,7 +120,7 @@ jobs:
117120
APP_DIR="/data/ust/dosportal/test"
118121
PROJECT_NAME="dosportal-test"
119122
fi
120-
123+
121124
# Manual workflow dispatch
122125
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
123126
SHOULD_DEPLOY="true"
@@ -136,18 +139,18 @@ jobs:
136139
PROJECT_NAME="dosportal-test"
137140
fi
138141
fi
139-
142+
140143
echo "should_deploy=$SHOULD_DEPLOY" >> $GITHUB_OUTPUT
141144
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
142145
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
143146
echo "app_dir=$APP_DIR" >> $GITHUB_OUTPUT
144147
echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT
145-
148+
146149
echo "Deployment decision:"
147150
echo " Should deploy: $SHOULD_DEPLOY"
148151
echo " Environment: $ENVIRONMENT"
149152
echo " Image tag: $IMAGE_TAG"
150-
153+
151154
- name: Create GitHub deployment
152155
if: steps.check.outputs.should_deploy == 'true' && steps.check.outputs.environment == 'test' && github.event_name == 'issue_comment'
153156
id: create_deployment
@@ -164,7 +167,7 @@ jobs:
164167
required_contexts: []
165168
});
166169
core.setOutput('deployment_id', deployment.data.id);
167-
170+
168171
await github.rest.repos.createDeploymentStatus({
169172
owner: context.repo.owner,
170173
repo: context.repo.repo,
@@ -187,7 +190,7 @@ jobs:
187190
dockerfile: backend.Dockerfile
188191
- component: frontend
189192
dockerfile: frontend.Dockerfile
190-
193+
191194
steps:
192195
- name: Get PR info if needed
193196
if: github.event_name == 'issue_comment'
@@ -203,23 +206,23 @@ jobs:
203206
core.setOutput('ref', pr.data.head.ref);
204207
core.setOutput('sha', pr.data.head.sha);
205208
core.setOutput('repo', pr.data.head.repo.full_name);
206-
209+
207210
- name: Checkout repository
208211
uses: actions/checkout@v6
209212
with:
210213
repository: ${{ github.event_name == 'issue_comment' && steps.pr_info.outputs.repo || github.repository }}
211214
ref: ${{ github.event_name == 'issue_comment' && steps.pr_info.outputs.ref || github.ref }}
212-
215+
213216
- name: Set up Docker Buildx
214217
uses: docker/setup-buildx-action@v3
215-
218+
216219
- name: Log in to the Container registry
217220
uses: docker/login-action@v3
218221
with:
219222
registry: ${{ env.REGISTRY }}
220223
username: ${{ github.actor }}
221224
password: ${{ secrets.GITHUB_TOKEN }}
222-
225+
223226
- name: Extract metadata (tags, labels) for Docker
224227
id: meta
225228
uses: docker/metadata-action@v5
@@ -230,7 +233,7 @@ jobs:
230233
type=ref,event=tag
231234
type=semver,pattern={{version}}
232235
type=raw,value=${{ needs.prepare.outputs.image_tag }}
233-
236+
234237
- name: Build and push Docker image (${{ matrix.component }})
235238
uses: docker/build-push-action@v6
236239
with:
@@ -285,14 +288,14 @@ jobs:
285288
envs: APP_DIR,ENV_FILE,COMPOSE_FILE,PROJECT_NAME,REGISTRY,IMAGE_NAME_BASE,IMAGE_TAG,COMPOSE_CONTENT
286289
script: |
287290
set -euo pipefail
288-
291+
289292
echo "==> Deploying to environment: $PROJECT_NAME"
290293
echo "==> Using image tag: $IMAGE_TAG"
291-
294+
292295
echo "==> Preparing app dir"
293296
mkdir -p "$APP_DIR/env"
294297
cd "$APP_DIR"
295-
298+
296299
echo "==> Creating docker-compose file"
297300
echo "$COMPOSE_CONTENT" | base64 -d > "$COMPOSE_FILE"
298301
@@ -302,14 +305,14 @@ jobs:
302305
echo "Creating dummy env file at $ENV_FILE"
303306
touch "$ENV_FILE"
304307
fi
305-
308+
306309
docker version >/dev/null
307310
docker compose version >/dev/null
308311
309312
echo "==> Remove old images with same tag to force fresh pull"
310313
docker rmi "$REGISTRY/$IMAGE_NAME_BASE-backend:$IMAGE_TAG" 2>/dev/null || true
311314
docker rmi "$REGISTRY/$IMAGE_NAME_BASE-frontend:$IMAGE_TAG" 2>/dev/null || true
312-
315+
313316
echo "==> Pull images (explicit, public GHCR)"
314317
docker pull "$REGISTRY/$IMAGE_NAME_BASE-backend:$IMAGE_TAG"
315318
docker pull "$REGISTRY/$IMAGE_NAME_BASE-frontend:$IMAGE_TAG"
@@ -337,7 +340,7 @@ jobs:
337340
docker image prune -af --filter "until=168h"
338341
339342
echo "==> Done"
340-
343+
341344
- name: Mark deployment as successful
342345
if: needs.prepare.outputs.environment == 'test' && github.event_name == 'issue_comment' && needs.prepare.outputs.deployment_id
343346
uses: actions/github-script@v7
@@ -351,7 +354,7 @@ jobs:
351354
environment_url: 'https://test.portal.dos.ust.cz',
352355
description: 'Deployment completed successfully'
353356
});
354-
357+
355358
- name: Update PR comment with deployment info
356359
if: needs.prepare.outputs.environment == 'test' && github.event_name == 'issue_comment' && needs.prepare.outputs.comment_id
357360
continue-on-error: true

.github/workflows/docker_deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
- name: Build backend image
2424
run: docker compose -f docker-compose.yml build backend
2525

26+
- name: Create .env file for tests
27+
run: cp .env.example .env
28+
2629
- name: Start dependencies
2730
run: docker compose -f docker-compose.yml up -d db_dosportal redis minio
2831

frontend/src/pages/DetectorCreatePage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useState, useRef, useEffect } from "react";
22
import { useNavigate } from "react-router-dom";
33
import { PageLayout } from "../components/PageLayout";
4-
// Removed FormField, use native inputs
54
import { theme } from "../theme";
65
import { LabeledInput } from "../components/LabeledInput";
76
import logbookBg from "../assets/img/SPACEDOS01.jpg";

readme.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# DOSPORTAL
22

33
![image](https://github.com/UniversalScientificTechnologies/xDOS_doc/assets/5196729/6b18ef7f-3251-4674-94ab-62444ec7ba43)
4-
> Preview from DOSPORTAL record page.
4+
5+
> Preview from DOSPORTAL record page.
56
67
DOSPORTAL is a web-based tool designed to manage and analyze dosimetry and spectrometry data, primarily from measurements conducted onboard aircraft. It provides an intuitive user interface for visualizing measurements, comparing datasets, and facilitating detector management. DOSPORTAL is being developed in collaboration with the [Nuclear Physics Institute CAS](https://www.ujf.cas.cz/en/) and (Universal Scientific Technologies s.r.o](https://www.ust.cz/). The platform is accessible via a web interface, ensuring users can interact with the data without the need for specialized software.
78

@@ -37,8 +38,8 @@ DOSPORTAL is designed to be platform-independent, ensuring accessibility from va
3738
### Currently Supported:
3839

3940
- **[AIRDOS Series](https://docs.dos.ust.cz/airdos/)**: Detectors designed for measuring ionizing radiation at flight altitudes aboard aircraft.
40-
- **[LABDOS Series](https://docs.dos.ust.cz/labdos)**: Portable ionizing radiation spectrometer-dosimeters intended for laboratory measurements or personal dosimetry.
41-
- **[GEODOS Series](https://docs.dos.ust.cz/geodos)**: Detectors suitable for ground-based applications, both mobile and stationary.
41+
- **[LABDOS Series](https://docs.dos.ust.cz/labdos)**: Portable ionizing radiation spectrometer-dosimeters intended for laboratory measurements or personal dosimetry.
42+
- **[GEODOS Series](https://docs.dos.ust.cz/geodos)**: Detectors suitable for ground-based applications, both mobile and stationary.
4243

4344
### Planned Support:
4445

@@ -104,14 +105,12 @@ cp .env.example .env
104105
2. Create the media bucket in MinIO
105106

106107
```bash
107-
docker run --rm --net=host \
108-
-e MC_HOST_minio=http://minioadmin:minioadmin@localhost:9000 \
109-
minio/mc mb --ignore-existing minio/dosportal-media
108+
docker compose exec backend python manage.py init_dosportal
110109
```
111110

112111
Or use the console at http://localhost:9001 (minioadmin/minioadmin).
113112

114-
3. Init database
113+
3. Init database & minio(s3 bucket)
115114

116115
```bash
117116
docker compose exec backend python3 manage.py makemigrations
@@ -122,9 +121,10 @@ cp .env.example .env
122121
```
123122

124123
4. Access services
125-
- React frontend: http://localhost:5173
126-
- Django Backend: http://localhost:8100
127-
- MinIO console: http://localhost:9001
124+
- React frontend: http://localhost:8080
125+
- Django Admin: http://localhost:8080/admin
126+
- Django API: http://localhost:8080/api
127+
- MinIO console: http://localhost:8080/s3
128128

129129
5. Tests (backend)
130130

0 commit comments

Comments
 (0)