add authrorization to npx and docker installation

This commit is contained in:
Henry 2023-05-27 14:32:41 +01:00
parent eee6b4d74b
commit 626e1b29f8
5 changed files with 55 additions and 2 deletions

View File

@ -1,7 +1,12 @@
# Build local monorepo image
# docker build --no-cache -t flowise .
# Run image
# docker run -d -p 3000:3000 flowise
# Run image with authorization
# docker run -d -e USERNAME=user -e PASSWORD=1234 -p 3000:3000 flowise
FROM node:18-alpine
RUN apk add --update libc6-compat

View File

@ -19,6 +19,12 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git
npx flowise start
```
With username & password
```bash
npx flowise start --USERNAME=user --PASSWORD=1234
```
3. Open [http://localhost:3000](http://localhost:3000)
## 🐳 Docker
@ -38,9 +44,17 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git
docker build --no-cache -t flowise .
```
2. Run image:
```bash
docker run -d --name flowise -p 3000:3000 flowise
```
With username & password
```bash
docker run -d -e USERNAME=user -e PASSWORD=1234 --name flowise -p 3000:3000 flowise
```
3. Stop image:
```bash
docker stop flowise

View File

@ -1 +1,3 @@
PORT=3000
PORT=3000
USERNAME=user
PASSWORD=1234

24
docker/README.md Normal file
View File

@ -0,0 +1,24 @@
# Flowise Docker Hub Image
Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/flowiseai/flowise/general)
## Usage
1. Create `.env` file and specify the `PORT` (refer to `.env.example`)
2. `docker-compose up -d`
3. Open [http://localhost:3000](http://localhost:3000)
4. You can bring the containers down by `docker-compose stop`
## With Authrorization
1. Create `.env` file and specify the `PORT`, `USERNAME`, and `PASSWORD` (refer to `.env.example`)
2. Pass `USERNAME` and `PASSWORD` to the `docker-compose.yml` file:
```
environment:
- PORT=${PORT}
- USERNAME=${USERNAME}
- PASSWORD=${PASSWORD}
```
3. `docker-compose up -d`
4. Open [http://localhost:3000](http://localhost:3000)
5. You can bring the containers down by `docker-compose stop`

View File

@ -1,4 +1,4 @@
import { Command } from '@oclif/core'
import { Command, Flags } from '@oclif/core'
import path from 'path'
import * as Server from '../index'
import * as DataSource from '../DataSource'
@ -14,6 +14,10 @@ let processExitCode = EXIT_CODE.SUCCESS
export default class Start extends Command {
static args = []
static flags = {
USERNAME: Flags.string(),
PASSWORD: Flags.string()
}
async stopProcess() {
console.info('Shutting down Flowise...')
@ -43,6 +47,10 @@ export default class Start extends Command {
console.error('uncaughtException: ', err)
})
const { flags } = await this.parse(Start)
if (flags.USERNAME) process.env.USERNAME = flags.USERNAME
if (flags.PASSWORD) process.env.PASSWORD = flags.PASSWORD
await (async () => {
try {
this.log('Starting Flowise...')