Skip to content

Commit ad0dda7

Browse files
committed
Describe initial security setup
1 parent e64ef1b commit ad0dda7

File tree

1 file changed

+73
-23
lines changed

1 file changed

+73
-23
lines changed

docs/infrastructure.md

Lines changed: 73 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ For an example, see https://docs.nginx.com/nginx/admin-guide/web-server/reverse-
169169

170170
### Docker Compose
171171

172-
To spin up the Stardog and API containers using Docker Compose,
172+
To spin up the API and graph backend containers using Docker Compose,
173173
ensure that both [docker](https://docs.docker.com/get-docker/) and [docker compose](https://docs.docker.com/compose/install/) are installed.
174174

175175
Run the following in the repository root (where the `docker-compose.yml` file is) to launch the containers:
@@ -190,42 +190,92 @@ If using the default port mappings, you can reach your local query tool at [http
190190

191191
## Setup for the first run
192192

193-
When you launch the Stardog graph for the first time,
193+
When you launch the graph backend for the first time,
194194
there are a couple of setup steps that need to be done.
195195
These will not have to be repeated for subsequent starts.
196196

197-
To interact with the Stardog graph,
197+
To interact with your graph backend,
198198
you have two general options:
199199

200-
1. Send HTTP request against the HTTP API of the Stardog graph instance (e.g. with `curl`). See [https://stardog-union.github.io/http-docs/](https://stardog-union.github.io/http-docs/) for a full reference of API endpoints
201-
2. Use the free Stardog-Studio web app. See the [Stardog documentation](https://docs.stardog.com/stardog-applications/dockerized_access#stardog-studio) for instruction to deploy Stardog-Studio as a Docker container.
200+
=== "Stardog"
201+
202+
203+
204+
1. Send HTTP request against the HTTP API of the Stardog graph instance (e.g. with `curl`). See [https://stardog-union.github.io/http-docs/](https://stardog-union.github.io/http-docs/) for a full reference of API endpoints
205+
2. Use the free Stardog-Studio web app. See the [Stardog documentation](https://docs.stardog.com/stardog-applications/dockerized_access#stardog-studio) for instruction to deploy Stardog-Studio as a Docker container.
202206

203207

204-
!!! info
205-
Stardog-Studio is the most accessible way
206-
of manually interacting with a Stardog instance.
207-
Here we will focus instead on using the HTTP API for configuration,
208-
as this allows programmatic access.
209-
All of these steps can also be achieved via Stardog-Studio manually.
210-
Please refer to the
211-
[official docs](https://docs.stardog.com/stardog-applications/studio/) to learn how.
208+
!!! info
209+
Stardog-Studio is the most accessible way
210+
of manually interacting with a Stardog instance.
211+
Here we will focus instead on using the HTTP API for configuration,
212+
as this allows programmatic access.
213+
All of these steps can also be achieved via Stardog-Studio manually.
214+
Please refer to the
215+
[official docs](https://docs.stardog.com/stardog-applications/studio/) to learn how.
216+
217+
=== "graphDB"
218+
219+
1. Send HTTP requests agains the HTTP API of the graphDB backend
220+
e.g. using `curl`. graphDB uses the [RDF4J API](https://rdf4j.org/documentation/reference/rest-api/) specification.
221+
2. Use the graphDB web interface (called [the workbench](https://graphdb.ontotext.com/documentation/10.0/architecture-components.html)).
222+
Once your local graphDB backend is running
223+
you can connect to it at [http://localhost:8000](http://localhost:8000)
224+
225+
226+
!!! info
227+
228+
Using the graphDB workbench is a more accessible way to manage the graphDB endpoint.
229+
The workbench is well documented on the graphDB website.
230+
Here we will focus instead on setting up graphDB with API calls,
231+
that can be automated.
212232

213233

214234
### Change the database admin password
215235

216-
When you first launch Stardog,
217-
a default `admin` user with superuser privilege
218-
will automatically be created for you.
219-
This `admin` user is meant to create other database users and modify their permissions.
220-
Do not use `admin` for read and write operations, instead use a [regular database user](#create-a-new-database-user).
236+
=== "Stardog"
221237

222-
You should first change the password of the database `admin`:
238+
When you first launch Stardog,
239+
a default `admin` user with superuser privilege
240+
will automatically be created for you.
241+
This `admin` user is meant to create other database users and modify their permissions.
242+
Do not use `admin` for read and write operations, instead use a [regular database user](#create-a-new-database-user).
223243

244+
You should first change the password of the database `admin`:
224245

225-
```console
226-
curl -X PUT -i -u "admin:admin" http://localhost:5820/admin/users/admin/pwd \
227-
--data '{"password": "NewPassword"}'
228-
```
246+
247+
```console
248+
curl -X PUT -i -u "admin:admin" http://localhost:5820/admin/users/admin/pwd \
249+
--data '{"password": "NewPassword"}'
250+
```
251+
252+
=== "graphDB"
253+
254+
When the API, graph, and query tool have been started and are running for the first time, you will have to do some first-run configuration.
255+
256+
**Setup security and users**
257+
258+
Also refer to the [official graphDB documentation](https://graphdb.ontotext.com/documentation/10.0/devhub/rest-api/curl-commands.html#security-management).
259+
260+
First, change the password for the admin user that has been automatically
261+
created by graphDB:
262+
263+
```
264+
curl -X PATCH --header 'Content-Type: application/json' http://localhost:7200/rest/security/users/admin -d '
265+
{"password": "NewAdminPassword"}'
266+
```
267+
make sure to replace `"NewAdminPassword"` with your own, secure password.
268+
269+
Next, enable graphDB security to only allow authenticated users access:
270+
```
271+
curl -X POST --header 'Content-Type: application/json' -d true http://localhost:7200/rest/security
272+
```
273+
274+
and confirm that this was successful:
275+
```
276+
➜ curl -X POST http://localhost:7200/rest/security
277+
Unauthorized (HTTP status 401)
278+
```
229279

230280
### Create a new database user
231281

0 commit comments

Comments
 (0)