Compare commits

...

5 Commits

1
.gitignore vendored

@ -1,3 +1,4 @@
/.data
/target
docker-compose.prod.yml
docker-compose.stage.yml

@ -3,6 +3,9 @@ name = "wownero-explorer"
version = "0.1.0"
authors = ["lza_menace <lza_menace@protonmail.com>"]
edition = "2018"
[[bin]]
name = "wownero-explorer"
path = "src/main.rs"
[dependencies]
rocket = "0.4.4"

@ -1,22 +1,34 @@
FROM ubuntu:19.10 as builder
# Install required packages
RUN apt-get update && apt-get install -y build-essential
RUN apt-get install -y curl git
# Setup app user and workspace
RUN useradd -m -d /home/wownero-explorer wownero-explorer
RUN mkdir -p /srv && chown -R wownero-explorer:wownero-explorer /srv
RUN mkdir -p /srv/wownero-explorer && chown -R wownero-explorer:wownero-explorer /srv
USER wownero-explorer
WORKDIR /srv
WORKDIR /srv/wownero-explorer
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | RUSTUP_HOME=/home/wownero-explorer/.rustup sh -s -- -y
RUN git clone https://git.wownero.com/lza_menace/wownero-explorer && \
cd wownero-explorer && \
~/.cargo/bin/rustup override set nightly && \
~/.cargo/bin/cargo build --release
FROM ubuntu:19.10
# Setup dummy build and perform release
COPY dummy.rs .
COPY Cargo.toml .
COPY Cargo.lock .
RUN sed -i 's_src/main.rs_dummy.rs_' Cargo.toml
RUN ~/.cargo/bin/rustup override set nightly
RUN ~/.cargo/bin/cargo build --release
# Put real source onto image and perform release
RUN sed -i 's_dummy.rs_src/main.rs_' Cargo.toml
COPY src src
RUN ~/.cargo/bin/cargo build --release
FROM ubuntu:19.10
COPY --from=builder /srv/wownero-explorer/target/release/wownero-explorer /bin/wownero-explorer
COPY static static
COPY templates templates
CMD 'wownero-explorer'

@ -1,11 +1,58 @@
## Wownero Explorer
Web interface for searching the Wownero blockchain.
A simple web interface for searching the Wownero blockchain.
## Running
## Quick-Start
### Docker
The fastest way to get it up and running to test it locally is to use the pre-made Docker container:
```
export DAEMON_URI=http://so.wow.candy.surf:34568
docker run -d \
--name wownero-explorer \
--rm \
-p 80:8000 \
-e DAEMON_URI=$DAEMON_URI \
lalanza808/wownero-explorer:latest
```
You could also just use `docker-compose`, though it will download a reverse proxy image:
```
export DAEMON_URI=http://so.wow.candy.surf:34568
docker-compose up -d
```
Navigate to http://localhost/ to browse the explorer.
### Rust
Alternatively, if you'd like to build/run using native Rust tools, follow these steps:
1. Install Rust: https://www.rust-lang.org/tools/install
2. Clone this repo: `git clone https://git.wownero.com/lza_menace/wownero-explorer && cd wownero-explorer`
3. Pin the nightly version of rust to the local directory: `rustup override set nightly`
4. [Pick a Wownero node](https://wownero.com) if you don't have one and apply the `DAEMON_URI` environment variable: `export DAEMON_URI=http://so.wow.candy.surf:34568`
5. Run the application: `cargo run`
6. Navigate to http://localhost:8000/
## Full Installation
I'm using [Traefik](https://docs.traefik.io/getting-started/concepts/) as a reverse proxy in order to handle automatic TLS certification with Let's Encrypt and to avoid manage Nginx configs. If you want to run the full installation you will need a registered domain and control of DNS records.
I don't feel like paying for a cluster for this simple app so I'm using `docker-compose` on a single box that I can recreate easily often to avoid config drift.
1. Create new file, `docker-compose.prod.yml` as a copy of `docker-compose.yml`
2. Uncomment labels under `wownero-explorer` service
3. Change labels to match external DNS name
4. Set `${ACME_EMAIL}` either as hardcoded string or pass as environment variable
5. Run `docker-compose -f docker-compose.prod.yml up -d`
## Questions?
Ask around in IRC: https://webchat.freenode.net/?room=#wownero

@ -2,21 +2,35 @@ version: '3'
services:
reverse-proxy:
image: traefik:v2.2
command: --api.insecure=true --providers.docker
command:
# Try to enable this if something isn't working. Chances are, Traefik will tell you why
# Be careful on production as it exposes the traffic you might not want to expose
#--log.level=DEBUG
--entrypoints.http.address=:80
--entrypoints.https.address=:443
--providers.docker=true
--api=false
--certificatesresolvers.letsencrypt.acme.httpchallenge=true
--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http
--certificatesresolvers.letsencrypt.acme.email=${ACME_EMAIL}
--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
ports:
# The HTTP port
- "8080:80"
# The Web UI (enabled by --api.insecure=true)
- "9000:8080"
- 80:80
- 443:443
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- .data/letsencrypt:/letsencrypt
wownero-explorer:
build:
context: .
dockerfile: Dockerfile
image: lalanza808/wownero-explorer:latest
command: wownero-explorer
labels:
- "traefik.http.routers.explorer.rule=Host(`localhost:8000`)"
- "traefik.http.routers.http.rule=Host(`localhost`)"
- "traefik.http.routers.http.entrypoints=http"
# - "traefik.http.routers.https.rule=Host(`localhost:8000`)"
# - "traefik.http.routers.https.entrypoints=https"
# - "traefik.http.routers.https.tls=true"
# - "traefik.http.routers.https.tls.certresolver=letsencrypt"
environment:
DAEMON_URI: ${DAEMON_URI}
ports:

@ -0,0 +1 @@
fn main() {}