Skip to content

Commit 1b6155e

Browse files
committed
fix bufs
1 parent 6cb176a commit 1b6155e

File tree

11 files changed

+64
-91
lines changed

11 files changed

+64
-91
lines changed
Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,36 @@
11

22
# Getting started
33

4-
5-
6-
const STORAGE = {
7-
S3: "S3",
8-
DOCKER_S3: 'DOCKER_S3',
9-
LOCAL: "LOCAL",
10-
};
11-
12-
module.exports = {
13-
STORAGE,
14-
ENV: {
15-
PORT: process.env.MANAGER_PORT || 5001,
16-
STORAGE: process.env.STORAGE || STORAGE.LOCAL,
17-
18-
// process.env.AWS_ACCESS_KEY_ID,
19-
// process.env.AWS_SECRET_ACCESS_KEY,
20-
// process.env.AWS_DEFAULT_REGION,
21-
S3_ENDPOINT: process.env.S3_ENDPOINT,
22-
S3_FORCE_PATH_STYLE: process.env.S3_FORCE_PATH_STYLE,
23-
S3_BUCKET: process.env.S3_BUCKET,
24-
AWS_DEFAULT_REGION: process.env.AWS_DEFAULT_REGION || 'us-east-1',
25-
26-
GITHUB_PERSONAL_TOKEN: process.env.GITHUB_PERSONAL_TOKEN,
27-
GITHUB_MAX_REPO_SIZE: process.env.GITHUB_MAX_REPO_SIZE,
28-
29-
// TODO - migrate to the new wasmer https://docs.wasmer.io/registry/get-started
30-
WAPM_REGISTRY_TOKEN: false, // process.env.WAPM_REGISTRY_TOKEN,
31-
32-
MANAGER_TEMPLATES: process.env.MANAGER_TEMPLATES,
33-
MANAGER_MAX_PARALLEL_JOBS: process.env.MANAGER_MAX_PARALLEL_JOBS || 2,
34-
MANAGER_ALLOWED_DOMAINS: process.env.MANAGER_ALLOWED_DOMAINS || 'localhost:5001',
35-
36-
AUTH_MODE: process.env.AUTH_MODE || 'NO_AUTH',
37-
OTOROSHI_TOKEN_SECRET: process.env.OTOROSHI_TOKEN_SECRET || 'veryverysecret',
38-
OTOROSHI_USER_HEADER: process.env.OTOROSHI_USER_HEADER,
39-
40-
EXTISM_RUNTIME_ENVIRONMENT: process.env.EXTISM_RUNTIME_ENVIRONMENT || false,
41-
CLI_AUTHORIZATION: process.env.CLI_AUTHORIZATION,
42-
CLI_AUTHORIZATION_HEADER: process.env.AUTHORIZATION_HEADER || 'Authorization',
43-
44-
LOCAL_WASM_JOB_CLEANING: process.envLOCAL_WASM_JOB_CLEANING || (60 * 60 * 1000) // 1 hour
45-
}
46-
}
47-
4+
## Prerequisites
5+
6+
- **Docker**: A Docker-enabled system with proper Docker access
7+
8+
Choose a path to install Wasmo Builder:
9+
- **With a database**: Use a database to store generated Wasm binaries. Can use the Builder API for editing plugins.
10+
- **Without a database (in-memory)**: Store generated Wasm binaries on the file system. In this mode, the Builder API is unavailable but the CLI keeps running.
11+
12+
Run the following command in your terminal to start your builder using a S3 storage:
13+
14+
```
15+
docker network create wasmo-network
16+
docker run -d --name s3Server \
17+
-p 8000:8000 \
18+
-e SCALITY_ACCESS_KEY_ID=access_key \
19+
-e SCALITY_SECRET_ACCESS_KEY=secret \
20+
--net wasmo-network scality/s3server
21+
docker run -d --net wasmo-network \
22+
--name wasmo \
23+
-p 5001:5001 \
24+
-e "AUTH_MODE=NO_AUTH" \
25+
-e "AWS_ACCESS_KEY_ID=access_key" \
26+
-e "AWS_SECRET_ACCESS_KEY=secret" \
27+
-e "S3_FORCE_PATH_STYLE=true" \
28+
-e "S3_ENDPOINT=http://localhost:8000" \
29+
-e "S3_BUCKET=wasmo" \
30+
-e "STORAGE=DOCKER_S3" \
31+
maif/wasmo
32+
```
33+
34+
If all goes well, Wasmo should now be serving your builder on [http://localhost:5001/](http://localhost:5001/).
35+
36+
If you are running Docker on MacOS, you should change `S3_ENDPOINT` to `http://host.docker.internal:8000`.

docs/documentation/app/builder/overview/page.mdx

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,6 @@ Wasmo Builder is an all-in-one builder for creating, editing and building **smal
1111

1212
# Key Features
1313

14-
- `Variety of languages`: Write plugins in your favorite language, Javascript, Typescript, Rust, Golang or Open Policy Agent.
15-
- `Build in one click`: Click the hammer and start using your wasm in seconds
16-
- `Fast starter`: Deploy the builder in-memory
17-
18-
# Start your first builder
19-
20-
## Prerequisites
21-
22-
- `Docker`: A Docker-enabled system with proper Docker access
23-
24-
Choose a path to install Wasmo Builder:
25-
- `With a database`: Use a database to store generated Wasm binaries. Can use the Builder API for editing plugins.
26-
- `Without a database (in-memory)`: Store generated Wasm binaries on the file system. In this mode, the Builder API is unavailable but the CLI keeps running.
27-
28-
Run the following command in your terminal to start your builder using a S3 storage:
29-
30-
```
31-
docker network create wasmo-network
32-
docker run --name s3Server \
33-
-p 8000:8000 \
34-
-e SCALITY_ACCESS_KEY_ID=access_key \
35-
-e SCALITY_SECRET_ACCESS_KEY=secret \
36-
--net wasmo-network scality/s3server
37-
docker run -d --net wasmo-network \
38-
--name wasmo \
39-
-p 5001:5001 \
40-
-e "AUTH_MODE=NO_AUTH" \
41-
-e "AWS_ACCESS_KEY_ID=access_key" \
42-
-e "AWS_SECRET_ACCESS_KEY=secret" \
43-
-e "S3_FORCE_PATH_STYLE=true" \
44-
-e "S3_ENDPOINT=http://localhost:8000" \
45-
-e "S3_BUCKET=wasmo" \
46-
-e "STORAGE=DOCKER_S3" \
47-
maif/wasmo
48-
```
49-
50-
If all goes well, Wasmo should now be serving your builder on [http://localhost:5001/](http://localhost:5001/)
14+
- **Variety of languages**: Write plugins in your favorite language, Javascript, Typescript, Rust, Golang or Open Policy Agent.
15+
- **Build in one click**: Click the hammer and start using your wasm in seconds
16+
- **Fast starter**: Deploy the builder in-memory
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use client"
2+
3+
import Layout from '@/components/Layout';
4+
import Page from './page.mdx';
5+
6+
export default function Home() {
7+
8+
return <Layout next={{
9+
href: "/cli/overview",
10+
title: "Wasmo CLI"
11+
}}>
12+
<Page />
13+
</Layout>
14+
15+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# Write your first plugin

docs/documentation/components/Sidebar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const LINKS = {
2-
Builder: ["Overview", "Getting started"],
2+
Builder: ["Overview", "Getting started", "Your first plugin"],
33
CLI: ["Getting started"],
44
Integrations: ["Otoroshi"],
55
}

docs/documentation/components/mdx/Misc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SyntaxHighlighter from 'react-syntax-highlighter'
44
import rainbow from 'react-syntax-highlighter/dist/esm/styles/hljs/tomorrow-night-blue'
55

66
export const Misc = {
7-
code: props => <span className="font-bold">{props.children}</span>,
7+
code: props => <span className="bg-gray-100 p-1 rounded">{props.children}</span>,
88
pre: props => {
99
const [copied, setCopied] = useState()
1010

server/configuration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626

2727
MANAGER_TEMPLATES: process.env.MANAGER_TEMPLATES,
2828
MANAGER_MAX_PARALLEL_JOBS: process.env.MANAGER_MAX_PARALLEL_JOBS || 2,
29-
MANAGER_ALLOWED_DOMAINS: process.env.MANAGER_ALLOWED_DOMAINS,
29+
MANAGER_ALLOWED_DOMAINS: process.env.MANAGER_ALLOWED_DOMAINS || 'localhost:5001',
3030

3131
AUTH_MODE: process.env.AUTH_MODE || 'NO_AUTH',
3232
OTOROSHI_TOKEN_SECRET: process.env.OTOROSHI_TOKEN_SECRET || 'veryverysecret',

server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function createServer(appVersion) {
6161
app.use(bodyParser.urlencoded({ extended: true }));
6262
app.use(bodyParser.text());
6363

64+
app.use('/', publicRouter);
6465
app.use('/', Security.extractUserFromQuery);
6566
app.use('/', Security.checkCLIToken);
6667
app.use('/api/plugins', pluginsRouter);
@@ -70,7 +71,6 @@ function createServer(appVersion) {
7071

7172
app.use('/health', (_, res) => res.json({ status: true }))
7273

73-
app.use('/', publicRouter);
7474
app.get('/', (_, res) => res.sendFile(path.join(__dirname, '..', 'ui/build', '/index.html')));
7575

7676
return http.createServer(app);

server/routers/public.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const auth = (req, res, next) => {
2121
const forbiddenAccess = (req, res, next) => {
2222
console.log(ENV.AUTH_MODE === 'AUTH')
2323
console.log(DOMAINS.includes(req.headers.host))
24-
console.log(Security.extractedUserOrApikey(req))
2524
console.log(req.headers.host)
2625
console.log(DOMAINS)
2726
res
@@ -51,7 +50,9 @@ router.get('/plugins', (req, res) => {
5150

5251
if (reg === '*') {
5352
UserManager.getUsers()
54-
.then(users => {
53+
.then(r => {
54+
const users = [...new Set([...(r || []), "adminotoroshiio"])];
55+
5556
if (users.length > 0) {
5657
Promise.all(users.map(UserManager.getUserFromString))
5758
.then(pluginsByUser => {

server/security/middlewares.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function extractedUserOrApikey(req) {
1818
const decodedToken = jwt.verify(jwtUser, secret, { algorithms: ['HS512'] });
1919
req.user = decodedToken.user
2020
req.apikey = decodedToken.apikey
21-
return decodedToken.user || decodedToken.apikey;
21+
return true;
2222
} catch (_) {
23-
return null;
23+
return false;
2424
}
2525
} else {
26-
return null;
26+
return false;
2727
}
2828
}
2929

0 commit comments

Comments
 (0)