Skip to content

Commit 6c733c7

Browse files
committed
[exoframe-website] Scaffold new docusaurus website, add old docs to it
Setup github action to auto-deploy it on push Addresses #259
1 parent 7642bbf commit 6c733c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+19731
-6166
lines changed

.github/workflows/website.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Website to Github pages
2+
# deploy website to github pages on push
3+
on:
4+
push:
5+
branches: '*'
6+
7+
jobs:
8+
deploy-website:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 20
15+
cache: 'npm'
16+
- name: install
17+
run: npm ci
18+
- name: build
19+
run: npm run build -w exoframe-website
20+
- name: Setup Pages
21+
uses: actions/configure-pages@v3
22+
- name: Upload artifact
23+
uses: actions/upload-pages-artifact@v2
24+
with:
25+
path: packages/exoframe-website/build
26+
- name: Deploy to GitHub Pages
27+
id: deployment
28+
uses: actions/deploy-pages@v2

package-lock.json

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

packages/exoframe-website/.eslintrc

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Exoframe Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ npm install
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ npm start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ npm run build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true npm run deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> npm run deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

packages/exoframe-website/components/header.js

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

packages/exoframe-website/components/intro.js

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

packages/exoframe-website/components/logo.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# Advanced topics
6+
7+
## Routing requests to specific path
8+
9+
Since Traefik supports routing requests to specific path, you can also do that with Exoframe.
10+
By default, Exoframe generates the following frontend string:
11+
12+
```js
13+
// where config is project config json
14+
Labels[`traefik.http.routers.${name}.rule`] = config.domain.includes('Host(')
15+
? // if string already contains Host() - use it as is
16+
config.domain
17+
: // otherwise - wrap it into Host()
18+
`Host(\`${config.domain}\`)`;
19+
```
20+
21+
You can route requests to path instead by using Traefik [router rules](https://docs.traefik.io/routing/routers/#rule) and using them inside of `domain` field in config.
22+
For example, you can route requests from `http://bots.domain.com/myhook` to your service.
23+
To achieve this, you will need to simply set `domain` field in the config file to ``Host(`bots.domain.com`) && Path(`/myhook`)``.
24+
This will route all requests from `bots.domain.com/myhook` to `your.service.host/myhook`.
25+
26+
If you need to strip or replace path, you have to provide additional label for Traefik.
27+
E.g. the following config will route `domain.com/myprefix` to `your.service.host`:
28+
29+
```json
30+
{
31+
"domain": "Host(`domain.com`) && Path(`/myprefix`)",
32+
"labels": {
33+
"traefik.http.middlewares.test-stripprefix.stripprefix.prefixes": "/myprefix"
34+
}
35+
}
36+
```
37+
38+
For more info and options see the aforementioned Traefik [router rules](https://docs.traefik.io/routing/routers/#rule) as well as [middlewares](https://docs.traefik.io/middlewares/overview/) docs.
39+
40+
## Docker-compose based deployment
41+
42+
Deploying using docker compose works almost the same as using a normal docker compose file, but there are a few labels you should use to ensure Traefik can correctly access your application.
43+
44+
version: '2'
45+
services:
46+
web:
47+
build: .
48+
labels:
49+
traefik.http.routers.web.rule: 'Host(`test.dev`)'
50+
redis:
51+
image: "redis:alpine"
52+
53+
Any of the [configuration options](https://docs.traefik.io/reference/dynamic-configuration/docker/) for the default Traefik docker setup can be used.
54+
55+
If you have a docker-compose.yml file, **any domain set in exoframe.json will be ignored**.
56+
57+
For the most part, Exoframe doesn't pass anything from `exoframe.json` to the compose.
58+
However, one thing that is being passed is environmental variables.
59+
You can use any variables defined in `exoframe.json` in your compose file.
60+
First, define them in your `exoframe.json`:
61+
62+
```json
63+
{
64+
"name": "test-compose-deploy",
65+
"env": {
66+
"CUSTOM_LABEL": "custom-value",
67+
"CUSTOM_SECRET": "@test-secret"
68+
}
69+
}
70+
```
71+
72+
Then use them inside your `docker-compose.yml`:
73+
74+
```yaml
75+
version: '2'
76+
services:
77+
web:
78+
build: .
79+
labels:
80+
traefik.http.routers.web.rule: 'Host(`test.dev`)'
81+
custom.envvar: '${CUSTOM_LABEL}'
82+
custom.secret: '${CUSTOM_SECRET}'
83+
redis:
84+
image: 'redis:alpine'
85+
```
86+
87+
## Rate limiting
88+
89+
Exoframe allows you to enable basic IP-based rate-limiting integrated into Traefik.
90+
To do that, simply specify the following fields in the project config file:
91+
92+
```js
93+
{
94+
// adding this object will enable IP-based rate-limiting
95+
"rate-limit": {
96+
// average request rate over given time period
97+
// defaults to 1 if not specified
98+
"average": 5,
99+
// maximal burst request rate over given time period
100+
// defaults to 5 if not specified
101+
"burst": 10
102+
}
103+
}
104+
```
105+
106+
This will define how many requests (`average`) over given time (`period`) can be performed from one IP address.
107+
For the example above - an average of 5 requests every second is allowed with busts of up to 10 requests.
108+
109+
For more information, see [Traefik rate-limiting docs](https://docs.traefik.io/middlewares/ratelimit/).
110+
111+
## Secrets
112+
113+
Exoframe allows you to create server-side secret values that can be used during service deployments.
114+
To use secrets you first need to create one. This can be done by running:
115+
116+
```
117+
$ exoframe secret new
118+
```
119+
120+
Once you specify the name and value, Exoframe server will create new secret _for your current user_.
121+
After creation the secret can be used in `exoframe.json` config file by using secret name and prefixing it with `@`, like so (in this example the secret was name `my-secret`):
122+
123+
```json
124+
"env": {
125+
"SECRET_KEY": "@my-secret"
126+
},
127+
```
128+
129+
Current caveats:
130+
131+
- Currently secrets only work for environment variables
132+
- Currently secrets work only for normal deployments (any template or recipe that uses `startFromParams` won't have secrets expanded)
133+
134+
## Accessing Exoframe data from within the deployed application
135+
136+
Exoframe provides a set of environment variables that are set on each deployment to allow getting project info and settings.
137+
Currently those are:
138+
139+
```bash
140+
# owner of current deployment
141+
EXOFRAME_USER=admin
142+
# project of current deployment
143+
EXOFRAME_PROJECT=projectName
144+
# full deployment ID
145+
EXOFRAME_DEPLOYMENT=exo-admin-deployName-ID
146+
# host used to expose current deployment (if any)
147+
EXOFRAME_HOST=exo-admin-deployName-ID.baseDomain
148+
```
149+
150+
## Plugins
151+
152+
Exoframe-Server supports extension of core features using plugins.
153+
Plugins are installed and loaded automatically once corresponding config is added to [server configuration](./server.md).
154+
Refer to specific plugins docs to see how to configure them.

0 commit comments

Comments
 (0)