Skip to content

Commit

Permalink
add docker-compose (#243)
Browse files Browse the repository at this point in the history
Co-authored-by: Ricki Moore <mrricki.m.usmc@gmail.com>
  • Loading branch information
antondlr and rickimoore authored Jun 25, 2024
1 parent 755ad9b commit d64cd27
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 109 deletions.
124 changes: 15 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,136 +17,42 @@ and Validator Client.
The [Lighthouse Book](https://lighthouse-book.sigmaprime.io) contains information for users and
developers. Specifically the [Lighthouse UI](https://lighthouse-book.sigmaprime.io/lighthouse-ui.html) section of the book.

## Building From Source

### Requirements

Building from source requires `Node v18` and `yarn`.

### Building From Source

The electron app can be built from source by first cloning the repository and
entering the directory:

```
$ git clone https://github.com/sigp/siren.git
$ cd siren
```

Once cloned, the electron app can be built and ran via the Makefile by:

```
$ make
```
## Running Siren

alternatively it can be built via:

```
$ yarn
```

Once completed successfully the electron app can be run via:

```
$ yarn dev
```

### Running In The Browser

#### Docker (Recommended)
### Docker (Recommended)

Docker is the recommended way to run a webserver that hosts Siren and can be
connected to via a web browser.

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

Recommended config for using the docker image (assuming the BN/VC API's are exposed on your localhost):

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

The docker image can be built and run with the following commands:
```
$ docker build -f Dockerfile -t siren .
```
Configuration is doen with environemnt variables, the best way to get started is by copying `.env.example` to `.env` and editing the relvant sections (typically, this would at least include `BEACON_URL`, `VALIDATOR_URL` and `API_TOKEN`)

Then to run the image:

```
$ docker run --rm -ti --name siren -p 3443:443 -v $PWD/.env:/app/.env:ro siren
```
Linux users may want to add this flag:
`--add-host=host.docker.internal:host-gateway`
`docker-compose up`
or
`docker run --rm -ti --name siren -p 3443:443 --env-file $PWD/.env sigp/siren`

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


To start Siren, visit `https://localhost:3443` in your web browser. (ignore the certificate warning).

Advanced users can mount their own certificate with `-v $PWD/certs:/certs` (the config expects 3 files: `/certs/cert.pem` `/certs/key.pem` `/certs/key.pass`)

# Running a Local Testnet

For development, one can spin up a local lighthouse testnet. This can be used
for the UI to connect to and retrieve real-time results from a local testnet.

## Requirements

In order to run a local lighthouse network, lighthouse needs to be installed on
the system. For detailed instructions see the [Lighthouse Book](https://lighthouse-book.sigmaprime.io/).

Both `lighthouse` and `lcli` are required to be installed. This can be done by
cloning the Lighthouse repository, entering the cloned repository and running:

```bash
$ make
$ make install-lcli
```

note: you need a version of lcli that includes [these](https://github.com/sigp/lighthouse/pull/3807) changes

`ganache` is also required to be installed. This can be installed via `npm` or via the OS. If using `npm` it can be installed as:

```
$ npm install ganache --global
```

## Starting the Testnet

To start a local testnet, move into the `local-testnet` directory. Then run:

```bash
./start_local_testnet.sh genesis.json
```

This will spin up both a validator client and a beacon node. These will run in
the background and can be accessed via their local http APIs.

## Stopping the Testnet

A running local testnet can be stopped by running:
## Building From Source

```bash
./stop_local_testnet.sh
```
### Docker

## Configuring the Testnet
The docker image can be built with the following command:
`docker build -f Dockerfile -t siren .`

The default settings should be sufficient for a development network useful for
testing the UI. However various configurations can be modified by modifying the
`vars.env` file.
### Building locally

## Creating a new testnet
Building from source requires `Node v18.18` and `yarn`.

The data for a previously run testnet is stored at
`./local-testnet/testnet-data` (assuming the scripts were run inside the
`local-testnet` directory. Simply removing this directory and its
subdirectories will create a new testnet when running these commands again.
#### Build and run the backend

## Logs and Errors
#### Build and run the frontend

Logs and errors can be found in the `./local-testnet/testnet-data` directory.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
siren:
image: sigp/siren
ports:
- "4443:443" # comment this line when using `SSL_ENABLED=false`
# - "4080:80" # uncomment this line when using `SSL_ENABLED=false`
env_file:
- .env

0 comments on commit d64cd27

Please sign in to comment.