Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Add authrorization to npx and docker installation #204

Merged
merged 1 commit into from
May 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docker/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
PORT=3000
PORT=3000
USERNAME=user
PASSWORD=1234
24 changes: 24 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -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`
10 changes: 9 additions & 1 deletion packages/server/src/commands/start.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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...')
Expand Down Expand Up @@ -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...')
Expand Down