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

refactor: remove demo dApp and flatten workspace #40

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
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
18 changes: 16 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
dist
node_modules
android
clients/liquid-auth-client-kt
.decisions
.github
.vscode
docs
__mocks__
.eslintrc.json
.gitignore
.prettierrc
ARCHITECTURE.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
docker-compose.yml
Dockerfile
README.md
SEQUENCE.md
Binary file removed .docs/Step-1-QRCode.png
Binary file not shown.
Binary file removed .docs/Step-1.png
Binary file not shown.
Binary file removed .docs/Step-2.png
Binary file not shown.
2 changes: 1 addition & 1 deletion .env.docker
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Application
NODE_ENV=production
SENTRY_DNS=
PORT=5173
PORT=3000

# Database
DB_HOST=mongo:27017
Expand Down
File renamed without changes.
File renamed without changes.
32 changes: 15 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ swagger-codegen-cli.jar
ngrok.yml
.data

# Kotlin
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
assetlinks.json
src/views
src/public
views
public

# Project Files
.env.production
.data
.vercel
.idea
.vscode

# Logs
logs
Expand Down Expand Up @@ -101,7 +97,6 @@ web_modules/
.env.test.local
.env.production.local
.env.local
!sites/dapp-ui/.env

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down Expand Up @@ -152,3 +147,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Sentry Config File
.sentryclirc
File renamed without changes.
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:20.12-alpine AS BUILDER
FROM node:22.8.0-alpine AS BUILDER

WORKDIR /home/node

ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache g++ make py3-pip pkgconfig pixman-dev cairo-dev pango-dev && ln -sf python3 /usr/bin/python
Expand All @@ -9,19 +11,19 @@ RUN npm ci

RUN npm run build

FROM node:20.12-alpine
FROM node:22.8.0-alpine

WORKDIR /home/node

# Dependencies
COPY --from=BUILDER /home/node/node_modules ./node_modules

# App Files
COPY --from=BUILDER ./node_modules ./node_modules
COPY --from=BUILDER ./package.json ./package.json
COPY --from=BUILDER ./package-lock.json ./package-lock.json
# Sites Files
COPY --from=BUILDER ./sites ./sites
# Service Files
COPY --from=BUILDER ./services/liquid-auth-api-js/ ./services/liquid-auth-api-js/
COPY --from=BUILDER /home/node/dist ./dist
COPY --from=BUILDER /home/node/src ./src
COPY --from=BUILDER /home/node/package.json ./package.json

# Expose the port on which the app will run
EXPOSE 3000
EXPOSE 5173

CMD ["npm", "run", "start"]
CMD ["npm", "run", "start:prod"]
61 changes: 25 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ A user must prove ownership of a private key to associate PublicKeyCredentials

## Getting started

This guide is designed to get the project running locally in a dockerized container.
See the full [Service Documentation](https://liquidauth.com/server/introduction/) for more information

### Prerequisites
- Node.js 18+
- Docker
Expand All @@ -29,22 +32,8 @@ git clone [email protected]:algorandfoundation/liquid-auth.git && cd liquid-auth

Sign up for a free account at [ngrok](https://ngrok.com/) and follow the instructions to get your <NGROK_AUTH_TOKEN> and <NGROK_STATIC_DOMAIN>.

#### With Docker
Don't run the ngrok commands directly as expressed in the ngrok guide as it will create run-time port conflicts.

#### Without Docker
ngrok will ask you to add your auth token to your configuration file.

``` bash
ngrok config add-authtoken <NGROK_AUTH_TOKEN>
```

Will then ask you to deploy your static domain, make sure to change the port to **5173** like this:

``` bash
ngrok http --domain=<NGROK_STATIC_DOMAIN> 5173
```

#### Configure NGROK

Add a `ngrok.yml` configuration to the root directory.
Expand All @@ -55,14 +44,14 @@ version: 2
authtoken: <NGROK_AUTH_TOKEN>
tunnels:
website:
addr: liquid-auth:5173
addr: liquid-auth:3000
proto: http
domain: <NGROK_STATIC_DOMAIN>

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

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

Update the [.env.docker](.env.docker) file with the following keys with the values from ngrok:

Expand All @@ -71,35 +60,35 @@ HOSTNAME=<NGROK_STATIC_DOMAIN>
ORIGIN=https://<NGROK_STATIC_DOMAIN>
```

### Start services
### User Interface

Run the following command to start the backend:
A quick way to test the service is using the documentation site included in this repository.

Navigate to the `docs` directory:

```bash
docker-compose up -d
cd docs
```

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


## Using the app
Copy the `.env.template` file to `.env`:

#### Install the [Android client](https://github.com/algorandfoundation/liquid-auth-android/releases) to your device.

![Step-1.png](.docs%2FStep-1.png)


### QR Connect

Open the Connect Modal on the website and scan the QR code using the "Connect" button on the Android device.
Follow the instructions on the Android device to register a credential.
```bash
cp .env.template .env
```

Update the `.env` file with the <NGROK_STATIC_DOMAIN>

![Step-1-QRCode.png](.docs%2FStep-1-QRCode.png)
```bash
PUBLIC_LIQUID_ORIGIN=<NGROK_STATIC_DOMAIN>
```

### Start services

### Peer to Peer
Run the following command to start the backend:

Once the credential is registered, you can send messages over the peer connection.
```bash
docker-compose up -d
```

![Step-2.png](.docs%2FStep-2.png)
Navigate to [https://localhost:4321](https://localhost:4321/#get-connected)
to view the documentation and try the demo on the landing page.
File renamed without changes.
File renamed without changes.
37 changes: 12 additions & 25 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
services:
documentation:
build:
context: ./docs
target: DEV
depends_on:
- liquid-auth
ports:
- "4321:4321"
volumes:
- ./docs:/home/node
liquid-auth:
build: .
restart: no
env_file:
- .env.docker
ports:
- "5173:5173"
- "3000:3000"
depends_on:
- redis
- mongo
command: ["npm", "run", "start:ssr"]
ngrok:
image: ngrok/ngrok:latest
restart: no
command:
- "start"
- "--all"
Expand All @@ -21,15 +28,13 @@ services:
volumes:
- ./ngrok.yml:/etc/ngrok.yml
ports:
- 4040:4040
- "4040:4040"
redis:
image: redis
restart: always
ports:
- "6379:6379"
mongo:
image: mongo:7.0
restart: no
environment:
- MONGO_INITDB_DATABASE=${DB_NAME:-fido}
- MONGO_INITDB_ROOT_USERNAME=${DB_USERNAME:-algorand}
Expand All @@ -38,23 +43,5 @@ services:
- "27017:27017"
volumes:
- mongo:/data/db
turn:
image: coturn/coturn
restart: no
deploy:
replicas: 0
depends_on:
- mongo
ports:
- "3478:3478"
- "3478:3478/udp"
- "5349:5349"
- "5349:5349/udp"
command:
- "--no-auth"
- "--mongo-userdb"
- "mongodb://${DB_USERNAME:-algorand}:${DB_PASSWORD:-algorand}@mongo:27017/${DB_NAME:-coturn}?authSource=admin&retryWrites=true&w=majority"
- "--redis-userdb"
- "ip=redis dbname=0"
volumes:
mongo:
17 changes: 17 additions & 0 deletions docs/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dist
node_modules
.decisions
.github
.vscode
docs
__mocks__
.eslintrc.json
.gitignore
.prettierrc
ARCHITECTURE.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
docker-compose.yml
Dockerfile
README.md
SEQUENCE.md
1 change: 1 addition & 0 deletions docs/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_LIQUID_ORIGIN=liquid-auth.onrender.com
20 changes: 20 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:22 AS BUILDER

WORKDIR /home/node

ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev -y

COPY . .

RUN npm ci

RUN npx playwright-core install --with-deps chromium && npm run build

FROM node:22-slim as DEV

WORKDIR /home/node

COPY --from=BUILDER /home/node ./

CMD ["npm", "run", "dev"]
11 changes: 0 additions & 11 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ export default defineConfig({
logo: {
src: "./public/logo.svg"
},
head:[
{
tag: 'script',
attrs: {
// Tweaks to the script URL or attributes can be made here.
src: 'https://unpkg.com/[email protected]',
integrity: "sha384-FhXw7b6AlE/jyjlZH5iHa/tTe9EpJ1Y55RjcgPbjeWMskSxZt1v9qkxLJWNJaGni",
crossorigin: "anonymous",
},
},
],
editLink: {
baseUrl: 'https://github.com/algorandfoundation/liquid-auth/edit/develop/docs/',
},
Expand Down
Loading
Loading