Skip to content

Commit

Permalink
Package siren (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
antondlr authored May 16, 2024
1 parent 89cbe0d commit 621ec7c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 53 deletions.
10 changes: 5 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PORT=3000
BACKEND_URL=
VALIDATOR_URL=
BEACON_URL=
API_TOKEN=
SESSION_PASSWORD=
BACKEND_URL=http://127.0.0.1:3001
BEACON_URL=http://your-BN-ip:5062
VALIDATOR_URL=http://your-VC-ip:5052
API_TOKEN=get-it-from-'.lighthouse/validators/api-token.txt'
SESSION_PASSWORD="your-password"
23 changes: 0 additions & 23 deletions Dockerfile

This file was deleted.

15 changes: 10 additions & 5 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ARG node_version=18
ARG node_image=node:${node_version}
FROM $node_image

ENV NODE_ENV=development
FROM $node_image AS dev

EXPOSE 5000/tcp
COPY . /app/
ENV NODE_ENV=development

WORKDIR /app/backend
RUN yarn --network-timeout 300000

WORKDIR /app
RUN yarn --network-timeout 300000

ENTRYPOINT /app/docker-entrypoint-dev.sh

RUN yarn install
CMD ["yarn", "run", "dev"]
# run with docker run --rm -ti -p 3000:3000 -v $PWD/.env:/app/.env:ro your-image-name
3 changes: 0 additions & 3 deletions Dockerfile.release

This file was deleted.

4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ build:
dev:
yarn && yarn start

# Runs a docker production webserver
docker:
docker build -t siren . && docker run --rm -it --name siren -p 80:80 siren

# Compile into a number of releases
release:
yarn && yarn build-all
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,35 +56,37 @@ $ yarn dev
#### Docker (Recommended)

Docker is the recommended way to run a webserver that hosts Siren and can be
connected to via a web browser. We recommend this method as it established a
production-grade web-server to host the application.
connected to via a web browser. For now, we only have a development docker image.

`docker` is required to be installed with the service running.

The docker image can be built and run via the Makefile by running:
Recommended config for using the development docker image (assuming the BN/VC API's are exposed on your localhost):

```
$ make docker
PORT=3000
BACKEND_URL=http://127.0.0.1:3001
VALIDATOR_URL=http://host.docker.internal:5062
BEACON_URL=http://host.docker.internal:5052
```

Alternatively, to run with Docker, the image needs to be built. From the repository directory
run:

The docker image can be built and run with the following commands:
```
$ docker build -t siren .
$ docker build -f Dockerfile.dev -t siren .
```

Then to run the image:

```
$ docker run --rm -ti --name siren -p 80:80 siren
$ docker run --rm -ti -p 3000:3000 -v $PWD/.env:/app/.env:ro siren
```
Linux users may want to add this flag:
`--add-host=host.docker.internal:host-gateway`


This will open port 3000 and allow your browser to connect.

This will open port 80 and allow your browser to connect. You can choose
another local port by modifying the command. For example `-p 8000:80` will open
port 8000.
To view Siren, simply go to `http://localhost:3000` in your web browser.

To view Siren, simply go to `http://localhost` in your web browser.

# Running a Local Testnet

Expand Down
8 changes: 8 additions & 0 deletions docker-entrypoint-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

cd /app/backend
yarn start &

cd /app

yarn dev

0 comments on commit 621ec7c

Please sign in to comment.