NODEDC_1C/docs/ARCH/setup.md

52 lines
1.4 KiB
Markdown

# Setup Guide
## 1. Install Miniconda (if missing)
```powershell
winget install -e --id Anaconda.Miniconda3 --source winget --accept-source-agreements --accept-package-agreements --silent
```
## 2. Create isolated environment
```powershell
$Conda = Join-Path $env:USERPROFILE "miniconda3\Scripts\conda.exe"
if (-not (Test-Path $Conda)) { $Conda = Join-Path $env:USERPROFILE "Miniconda3\Scripts\conda.exe" }
& $Conda create -y -n ndc_1c_mvp python=3.11
$EnvPython = Join-Path $env:USERPROFILE "miniconda3\envs\ndc_1c_mvp\python.exe"
if (-not (Test-Path $EnvPython)) { $EnvPython = Join-Path $env:USERPROFILE "Miniconda3\envs\ndc_1c_mvp\python.exe" }
& $EnvPython -m pip install -r requirements.txt
```
## 3. Configure environment variables
```powershell
copy .env.example .env
```
Set real values for:
- `ONEC_BASE_URL`
- `ONEC_INFOBASE`
- `ONEC_USERNAME`
- `ONEC_PASSWORD`
## 4. Run OData probe
```powershell
& $EnvPython -m odata_probe.fetch_metadata
& $EnvPython -m odata_probe.list_entity_sets
& $EnvPython -m odata_probe.probe_entities
& $EnvPython -m odata_probe.dump_sample_links
```
## 5. Run API
```powershell
& $EnvPython -m uvicorn canonical_layer.app:app --host 127.0.0.1 --port 8000 --reload
```
## Notes
- Project mode is read-only against 1C.
- For production, restrict OData role permissions to read-only.
- If OData is not published yet, probe scripts will fail by design and log the connectivity problem.