1
1
# README - Serving RDF with Docker & Flask
2
2
3
3
## Overview
4
- This project provides a simple ** Dockerized RDF endpoint** that serves an ` .rdf ` file with the correct ` Content-Type: application/rdf+xml ` , ensuring compatibility with ** DCAT-AP federators ** and ** RDF parsers ** like ` rdflib ` .
4
+ This project provides a simple ** Dockerized RDF endpoint** that serves an ` .rdf ` file an provides an SPARQL Endpoint based on [ ` vemonet/ rdflib-endpoint ` ] ( https://github.com/vemonet/rdflib-endpoint )
5
5
6
+ The RDF file using the correct ` Content-Type: application/rdf+xml ` , ensuring compatibility with ** DCAT-AP federators** and ** RDF parsers** like ` rdflib ` .
6
7
7
8
## Quick Start
8
9
Use [ Codespaces] ( https://github.com/features/codespaces ) to test ` easy-rdf-endpoint ` in your browser
@@ -18,22 +19,22 @@ Before starting the deployment, you'll need to set up a `.env` file. This file i
18
19
1 . Clone project
19
20
``` shell
20
21
cd /path/to/my/project
21
- git clone https://github.com/mjanez/easy-rdf-endpoint.git & cd ckan-docker
22
+ git clone https://github.com/mjanez/easy-rdf-endpoint.git & cd easy-rdf-endpoint
22
23
```
23
24
24
- 2. Copy the ` .env.example` template and modify the resulting ` .env` to suit your needs.
25
+ 2. Copy the [ ` .env.example` ](.env.example) template and modify the resulting ` .env` to suit your needs.
25
26
26
27
` ` ` shell
27
28
cp .env.example .env
28
29
` ` `
29
30
30
- Adjust the vars as necessary
31
+ Adjust the vars as necessary, example:
31
32
` ` ` ini
32
- # Host Ports
33
- SV_PORT_HOST=5000
33
+ # Server Configuration
34
+ PROXY_SERVER_NAME=my-example-sparql-server.org
34
35
35
- # Options
36
- CATALOG_FILE=catalog.rdf
36
+ # RDF of filename in folder ./data
37
+ CATALOG_FILE=my-custom- catalog.rdf
37
38
` ` `
38
39
39
40
3. Build & up the container.
@@ -42,27 +43,101 @@ Before starting the deployment, you'll need to set up a `.env` file. This file i
42
43
docker compose up -d
43
44
` ` `
44
45
45
- Then, access your RDF file at:
46
-
47
- 👉 ` http://localhost:5000/catalog.rdf`
46
+ Then, access your RDF file an [endpoints](# endpoints).
48
47
49
48
---
50
49
50
+ # ## Endpoints
51
+ The endpoints will be available at:
52
+ * Landing page[` http://localhost:5000` ](http://localhost:5000)
53
+ * Access your RDF file at: [` http://localhost:5000/catalog` ](http://localhost:5000/catalog)
54
+ * Default query editor (Yasgui): [` http://localhost:5000/sparql-editor` ](http://localhost:5000/sparql-editor)
55
+ * SPARQL endpoint: [` http://localhost:5000/sparql` ](http://localhost5000/sparql)
56
+
51
57
# # Project Structure
52
- ```
53
- /rdf-server
54
- │── /data/catalog.rdf # Your RDF file (replace with your own)
55
- │── /scr/app.py # Flask server to serve RDF
56
- │── /src/requirements.txt # Python dependencies
57
- │── /docker/Dockerfile # Docker setup
58
+ ` ` ` sh
59
+ /easy-rdf-endpoint
60
+ │── /data/catalog.rdf # Your Catalog RDF file (replace with your own)
61
+ │── /doc/ # References, as images or documents, used in repo
62
+ │── /easy-rdf-endpoint/ # RDF+SPARQL Endpoint setup
63
+ │── /nginx/ # NGINX docker setup
64
+ │── /src/ # Now using NGINX instead of the old RDF serving mode
65
+ │── .env.example # Sample ENVVars file for use with Docker Compose
58
66
│── docker-compose.yml # Docker Compose config
59
67
│── README.md # Documentation
60
68
` ` `
61
69
62
- ## Notes
63
- - Replace `catalog.rdf` with your actual RDF file.
64
- - Modify `app.py` if you need additional routes or enhancements.
65
- - Works with **Codespaces, Docker, Kubernetes, and any containerized environment**.
70
+ [! NOTE]
71
+ > - Replace ` catalog.rdf` with your actual RDF file.
72
+ > - Works with ** Codespaces, Docker, Kubernetes, and any containerized environment** .
73
+
74
+ # # Update SSL Certificate
75
+ To update the local SSL certificate, follow these steps:
76
+
77
+ 1. Generate a new certificate and private key:
78
+ ` ` ` sh
79
+ openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
80
+ -keyout nginx/setup/easy-rdf-endpoint_local.key \
81
+ -out nginx/setup/easy-rdf-endpoint_local.crt \
82
+ -subj " /C=ES/ST=Madrid/L=Madrid/O=Development/CN=localhost"
83
+ ` ` `
84
+
85
+ 2. Verify that the files have been created correctly:
86
+ ` ` ` sh
87
+ ls -l nginx/setup/easy-rdf-endpoint_local.*
88
+ ` ` `
89
+
90
+ 3. Restart the ` nginx` container to apply the changes:
91
+ ` ` ` sh
92
+ docker compose restart nginx
93
+ ` ` `
94
+
95
+ > [! CAUTION]
96
+ > This certificate is for local development only. In production, use a valid certificate from a certificate authority.
97
+
98
+ # # Development
99
+
100
+ # ## Using DevContainers
101
+ This project supports development using DevContainers, which provides a consistent development environment for all contributors.
102
+
103
+ ** Requirements** :
104
+ * [Docker](https://docs.docker.com/get-docker/)
105
+ - [VS Code](https://code.visualstudio.com/) or [GitHub Codespaces](https://github.com/features/codespaces)
106
+ - [VS Code Remote - Containers extension](https://docs.rancherdesktop.io/how-to-guides/vs-code-remote-containers/)
107
+
108
+ # ### Getting Started with DevContainer
109
+ 1. Clone the repository:
110
+ ` ` ` bash
111
+ git clone https://github.com/mjanez/easy-rdf-endpoint.git
112
+ cd easy-rdf-endpoint
113
+ ` ` `
114
+
115
+ 2. Open in VS Code:
116
+ ` ` ` bash
117
+ code .
118
+ ` ` `
119
+
120
+ 3. When prompted " *Reopen in Container*" , click " *Reopen in Container*" . Alternatively:
121
+ - Press ` F1`
122
+ - Type " *Remote-Containers: Reopen in Container*"
123
+ - Press * Enter*
124
+
125
+ VS Code will build and start the development container. This may take a few minutes the first time.
126
+
127
+ # ### What's Included
128
+ The development container includes:
129
+ - Python 3.11 environment
130
+ - Required Python packages pre-installed
131
+ - Popular VS Code extensions for Python/Docker development
132
+ - Git configuration
133
+ - Port forwarding for the application
134
+
135
+ # ### Working in the Container
136
+ Once inside the container you can:
137
+ - Run the application: ` exec gunicorn --bind 0.0.0.0:5000 app:app`
138
+ - Modify the [` easy-rdf-endpoint/setup/rdflib-endpoint/sparql_override.py` ](./easy-rdf-endpoint/setup/rdflib-endpoint/sparql_override.py)
139
+ - Execute SPARQL queries: ` http://localhost:5000/sparql`
140
+ - Debug with VS Code' s integrated debugger
66
141
67
142
## License
68
143
This project is licensed under the **MIT License**.
0 commit comments