Skip to content

Commit 6b534b1

Browse files
authored
Merge pull request #13 from orchestracities/fix-build
Migrate to Nix
2 parents 0db46d6 + e779a9e commit 6b534b1

File tree

16 files changed

+277
-68
lines changed

16 files changed

+277
-68
lines changed

.gitlab-ci.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.readthedocs.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,91 @@
1-
# Orchestra Cities
2-
3-
[![Documentation badge](https://img.shields.io/readthedocs/orchestracities.svg)](https://docs.orchestracities.io/en/latest/)
1+
# Orchestra Cities
42

53
![OC Logo](docs/rsrc/OC_Logo_color-300x190.jpg)
64

75
**Orchestra Cities** is a data and IoT-driven solution that allows cities to
86
collaboratively develop and share Smart City Services using Open APIs and
97
Open Standards. Launched in 2018 by [Martel Innovate](https://www.martel-innovate.com),
108
Orchestra Cities was initially developed and tested with Antwerp and Helsinki
11-
as solution for the [Select4Cities](https://www.select4cities.eu/)
9+
as a solution for the [Select4Cities](https://www.select4cities.eu/)
1210
Pre-Commercial Procurement (PCP). Following the PCP, Martel further invested
1311
on the platform for the benefit of its customers.
1412

15-
## Documentation
1613

17-
This repository hosts the main documentation of Orchestra Cities.
14+
### Repository content
15+
16+
This repository hosts the source and build tools for Orchestra Cities'
17+
documentation site.
18+
19+
The documentation consists of an introduction, where the most important
20+
topics and ideas are briefly explained, and a tutorial, where the user
21+
can get some hands-on experience of the most important platform features.
22+
23+
The documentation site source is in the `docs` folder and it gets fed
24+
into MkDocs to build a static site. Nix provides reproducible, sand-boxed
25+
and cross-platform development environments.
26+
27+
28+
### Development environment
29+
30+
We use Nix to get proper, isolated and reproducible development
31+
environments. This is a sort of virtual shell environment on steroids
32+
which has in it all the tools you need with the right versions. Plus,
33+
it doesn't pollute your machine with libraries that could break your
34+
existing programs—everything gets installed in an isolated Nix store
35+
directory and made available only in the Nix shell.
36+
37+
First off, you should install Nix and enable the Flakes extension
38+
39+
```bash
40+
$ sh <(curl -L https://nixos.org/nix/install) --daemon
41+
$ mkdir -p ~/.config/nix
42+
$ echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
43+
```
44+
45+
Now you can get into our Nix shell and use the tools you need to
46+
develop: Bash, git, MkDocs, etc.
47+
48+
```bash
49+
$ cd nix
50+
$ nix shell
51+
```
52+
53+
54+
### Editing content
55+
56+
The documentation site source is in the `docs` folder. Write in plain
57+
markdown. Use figures accordingly. Put images and binary resources
58+
in `docs/rsrc`. Respect the naming schema of the files in there to
59+
keep it reasonably organised.
60+
61+
You can build the documentation site and live edit it easily with
62+
the `mkdocs` command. After getting into the Nix shell as explained
63+
earlier, go back to the repository's root directory and run
64+
65+
```bash
66+
$ mkdocs build
67+
```
68+
69+
This will output the whole static site in the `site` directory—there's
70+
a `.gitignore` file to keep this directory out of source control. To
71+
see what the site looks like, run
1872

19-
It consists of an introduction, where the most important topics and ideas are
20-
briefly introduced, and a tutorial, where the user can get a first hands-on
21-
experience on the most important operations of the platform.
73+
```bash
74+
$ mkdocs serve
75+
```
2276

23-
### Organisation
77+
and then browse to http://localhost:8000. If you edit files in the
78+
`docs` directory, your changes should be reflected in the browser.
2479

25-
Documentation is found in the `docs` folder.
2680

27-
Write in plain markdown. Use figures accordingly.
81+
### Deploying the site
2882

29-
Images and binary resources are saved in `docs/rsrc` folder. Respect the naming
30-
schema of the files in there to keep it reasonably organised.
83+
To go live with your changes, first build the Nix package
3184

32-
### Usage
85+
```bash
86+
$ cd nix
87+
$ nix build .#docs-site
88+
```
3389

34-
1. Run `sh run.sh`
35-
1. Open `http://127.0.0.1:8000/` in your explorer and you should see the docs
36-
1. You can now edit them and changes will be reflected on the fly.
90+
then upload and extract `result/docs.tgz` to our Nginx machine
91+
serving `docs.orchestracities.com`.

docs/gravitee.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ in the Developer Portal and how policies and Oauth2 authorization are handled.
1111
It's worth reminding that the public clients set up in Keycloak will
1212
limit what the given tokens enable users to do, such as user management operations.
1313
The user requests a specific scope with the request (e.g. entity:read). A list
14-
of scopes is available in the [**Keycloak Configuration**](/keycloak) section of this documentation.
14+
of scopes is available in the [**Keycloak Configuration**](keycloak.md) section of this documentation.
1515

1616
2. When then token is used, it is validated against Keycloak's confidential client
1717
(the resource-server client). The operation being attempted (e.g. creating an
@@ -58,7 +58,7 @@ The configuration contains:
5858
For each API endpoint, policies are in place for each operation. This enables API
5959
owners to decide exactly what scopes are required for users to perform different
6060
operations, whether is accessing, editing, creating or deleting resources.
61-
See the [**Keycloak Configuration**](/keycloak) section for more details on
61+
See the [**Keycloak Configuration**](keycloak.md) section for more details on
6262
client scopes.
6363

6464
Policies follow a basic syntax of resource:operation, so for the /entities endpoint

mkdocs.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
1-
site_name: "Orchestra Cities"
1+
site_name: Orchestra Cities
22
site_url: https://orchestracities.com
3-
site_description: 'Orchestra Cities Documentation'
4-
site_author: 'Martel Innovate'
5-
copyright: 'Copyright &copy; 2020 - Martel Innovate'
6-
theme: readthedocs
7-
#markdown_extensions: [toc,fenced_code]
3+
site_description: Orchestra Cities Documentation
4+
site_author: Martel Innovate
5+
copyright: Copyright &copy; 2020 - Martel Innovate
6+
theme:
7+
name: readthedocs
8+
locale: en
89
markdown_extensions:
9-
- toc:
10-
permalink: "#"
11-
- fenced_code:
10+
- fenced_code
11+
- toc:
12+
permalink: "#"
13+
validation:
14+
links:
15+
absolute_links: relative_to_docs
16+
anchors: warn
17+
unrecognized_links: warn
1218
docs_dir: docs
1319
nav:
14-
- '0. Introduction': 'index.md'
15-
- '1. Platform overview': 'overview.md'
16-
- '2. Architecture': 'architecture.md'
17-
- '3. Deploy an example instance': 'deploy.md'
18-
- '4. Security configuration':
19-
- '4.1. Auth Provider (Keycloak)': 'keycloak.md'
20-
- '4.2. Api Management (Gravitee)': 'gravitee.md'
21-
- '4.3. Admin Portal': 'portal.md'
22-
- '5. Tutorial': 'tutorial.md'
23-
- '6. How to contribute': 'contribute.md'
20+
- 0. Introduction: index.md
21+
- 1. Platform overview: overview.md
22+
- 2. Architecture: architecture.md
23+
- 3. Deploy an example instance: deploy.md
24+
- 4. Security configuration:
25+
- 4.1. Auth Provider (Keycloak): keycloak.md
26+
- 4.2. Api Management (Gravitee): gravitee.md
27+
- 4.3. Admin Portal: portal.md
28+
- 5. Tutorial: tutorial.md
29+
- 6. How to contribute: contribute.md

nix/flake.lock

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix/flake.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
description = "Flake to build and develop orchestra cities docs.";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOs/nixpkgs";
6+
nixie = {
7+
url = "github:c0c0n3/nixie";
8+
inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
};
11+
12+
outputs = { self, nixpkgs, nixie }:
13+
let
14+
build = nixie.lib.flakes.mkOutputSetForCoreSystems nixpkgs;
15+
pkgs = build (import ./pkgs/mkSysOutput.nix);
16+
in
17+
pkgs;
18+
}

nix/pkgs/cli-tools/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ pkgs }: pkgs.callPackage ./pkg.nix {}

nix/pkgs/cli-tools/docs.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CLI Tools
2+
---------
3+
> Nix package docs.
4+
5+
CLI tools to build and develop Orchestra Cities docs. These tools
6+
include all you need, even Bash, ensuring dev env reproducibility
7+
across different environments---Linux x86_64 and ARM64, MacOS Intel
8+
and Apple silicon. Have a look at [pkg.nix][pkg] to see what tools
9+
we bundle.
10+
11+
12+
13+
14+
[pkg]: ./pkg.nix

0 commit comments

Comments
 (0)