Skip to content

Commit

Permalink
build: add ngrok to docker
Browse files Browse the repository at this point in the history
- fixes #11
- fixes #12
  • Loading branch information
PhearZero committed Apr 22, 2024
1 parent 6cc3eef commit 325edae
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ REDIS_PASSWORD=

# FIDO2
RP_NAME=Algorand Foundation FIDO2 Server
HOSTNAME=fido-home.telluric.guru
ORIGIN=https://fido-home.telluric.guru
HOSTNAME=catfish-pro-wolf.ngrok-free.app
ORIGIN=https://catfish-pro-wolf.ngrok-free.app

ANDROID_SHA256HASH=47:CC:4E:EE:B9:50:59:A5:8B:E0:19:45:CA:0A:6D:59:16:F9:A9:C2:96:75:F8:F3:64:86:92:46:2B:7D:5D:5C
ANDROID_PACKAGENAME=foundation.algorand.demo
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
swagger-codegen-cli.jar
ngrok.yml

.data
.idea
Expand Down
29 changes: 20 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,31 @@ WebAuthn requires a secure context (HTTPS) to work and this will not allow you t
Sign up for a free account at [ngrok](https://ngrok.com/) and install the ngrok package.
Configure a Static Domain for your ngrok account and update the [.env](services/liquid-auth-api-js/README.md) file with the following keys with the values from ngrok:


#### Configure NGROK

```bash
HOSTNAME=example-static-domain.ngrok-free.app
ORIGIN=https://example-static-domain.ngrok-free.app
cp ./ngrok.template.yml ngrok.yml
```

#### Run the ngrok proxy
Make sure to update the `authtoken` and `domain` in the `ngrok.yml` file with your ngrok details.

```yaml
version: 2
authtoken: <NGROK_AUTH_TOKEN>
tunnels:
website:
addr: 5173
proto: http
domain: <STATIC_DOMAIN>

```

#### Update the Service's .docker.env file

```bash
ngrok http --domain=example-static-domain.ngrok-free.app 5173
HOSTNAME=example-static-domain.ngrok-free.app
ORIGIN=https://example-static-domain.ngrok-free.app
```

#### Start services
Expand All @@ -53,10 +69,5 @@ Run the following command to start the backend:
docker-compose up -d
```

#### Run the Demo App
```bash
npm run dev:ui
```

Navigate to the ngrok URL in your browser to test the FIDO2 feature.

71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,77 @@ This project holds the standard FIDO2 api endpoints and the Proof of Knowledge f
The api is a stateful session-based architecture with endpoint guards.
A user must prove ownership of a private key to associate PublicKeyCredentials



## Getting started

### Prerequisites
- Node.js 20
- Docker

#### Clone the project

```bash
git clone [email protected]:algorandfoundation/liquid-auth.git && cd liquid-auth
```

#### Install package dependencies

```bash
npm install
```

#### Build Dependencies

```bash
npm run build
```

WebAuthn requires a secure context (HTTPS) to work and this will not allow you to test the FIDO2 feature in your local machine.

### NGROK

Sign up for a free account at [ngrok](https://ngrok.com/) and install the ngrok package.
Configure a Static Domain for your ngrok account and update the [.env](services/liquid-auth-api-js/README.md) file with the following keys with the values from ngrok:


#### Configure NGROK

```bash
cp ./ngrok.template.yml ngrok.yml
```

Make sure to update the `authtoken` and `domain` in the `ngrok.yml` file with your ngrok details.

```yaml
version: 2
authtoken: <NGROK_AUTH_TOKEN>
tunnels:
website:
addr: 5173
proto: http
domain: <STATIC_DOMAIN>

```

#### Update the Service's .docker.env file

```bash
HOSTNAME=example-static-domain.ngrok-free.app
ORIGIN=https://example-static-domain.ngrok-free.app
```

#### Start services

Run the following command to start the backend:

```bash
docker-compose up -d
```

Navigate to the ngrok URL in your browser to test the FIDO2 feature.


## Using the app

#### Install the [Android client]() to your device and navigate to https://nest-fido2.onrender.com/.
Expand Down
12 changes: 12 additions & 0 deletions Vite.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:20-alpine

ADD . .

RUN npm install

RUN npm run build


EXPOSE 5173

CMD ["npm", "run", "dev:ui"]
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,32 @@ services:
depends_on:
- redis
- mongo
- ngrok
liquid-demo:
build:
context: .
dockerfile: Vite.Dockerfile
ports:
- "5173:5173"
restart: always
environment:
- PROXY_URL=http://liquid-auth:3000
- WSS_PROXY_SERVER=ws://liquid-auth:3000
depends_on:
- liquid-auth
- ngrok
ngrok:
image: ngrok/ngrok:latest
restart: unless-stopped
command:
- "start"
- "--all"
- "--config"
- "/etc/ngrok.yml"
volumes:
- ./ngrok.yml:/etc/ngrok.yml
ports:
- 4040:4040
redis:
image: redis
restart: always
Expand Down
7 changes: 7 additions & 0 deletions ngrok.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
authtoken: <NGROK_AUTH_TOKEN>
tunnels:
website:
addr: liquid-demo:5173
proto: https
domain: <NGROK_STATIC_DOMAIN>

0 comments on commit 325edae

Please sign in to comment.