Skip to content

Commit

Permalink
chore(misc/loop): Setup the portal loop infra
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx committed Nov 30, 2023
1 parent 726349d commit 19eaba4
Show file tree
Hide file tree
Showing 10 changed files with 308 additions and 16 deletions.
26 changes: 26 additions & 0 deletions misc/loop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# The portal loop :infinity:

## What is it ?

It's a Gnoland node that aim to run with always the latest version of gno and never loose transactions history.

For more information, see issue on github [gnolang/gno#1239](https://github.com/gnolang/gno/issues/1239)


## How to use

Start the loop with:

``` sh
$ docker compose up -d
```

The `snapshotter` container will exec the script [switch.sh](./scripts/switch.sh) every day at 10am (defined in the docker image).

This script is doing:

- Pull the new docker image [ghcr.io/gnolang/gno]
- Backup the txs using [gnolang/tx-archive](https://github.com/gnolang/tx-archive)
- Start a new docker container with the backups files
- Changing the proxy (traefik) to redirect to the new portal loop
- Stop the previous loop
12 changes: 12 additions & 0 deletions misc/loop/backups/backup-with-failed.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"4DBMw+h6VWyG+mQGZRnFjgOvc0F2R0QVmS4xHFkoAgkQZA5urLAZbv6mDuWGrNhkZIFmlBfPwgL62G2v4v7TZA=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"rmcT3Pi1pCP4caamMJPnQdKM4rDzkWDaiGsgVsmleAY+QNAr6O4kbvi/zmi1GtrXvG3Mkc43ryNdibKKyCfdlw=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"Kf/cBreBmTThcIf0sO5m2pfOfX13uus34Krmz9fV2PEDO7EyoWtaj212y3VI6IxkXrAEH4C4QRF4Snpfym9afw=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"pKUQqoFZk6yI4d8uJ2c3KN/Uiq1UMaLyaD0T7um0RZ1idzWPhfMrOY/137smB+aa2WlHAP61QOf3maCS7BohMg=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"ITL67CvMMGLUYfQk4FQZSX8s1F+e0ldvtn91HcsDaTR1alzBWeMJ8j8yG5XabjPZyqb89P7HA8Bcf6TSJ3/AnQ=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"TH0qoKSHhi0hu50R03tEOvV4Wh4J14cmjAsjSwDnk/EtAwINKyl14rBztdtwlawMreIss67tiHf4GBXknEGP8g=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"xZPqS0WKfsCSi9VLjNVXFYLIAK0ZBpORkhoxPCEMAYgkUBY6HeTTUnsPffUHF3GEPQZnEvp0XiGGuOZ5H59HFg=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"tykpijNkJhWNoS8KdA/v6dAHpSGOZn23RTvfF9q2PpIpcvre2SfW8sFlSvq9tcDyHH7xlgQavHCcjRfjzoqffg=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"f4sxA0IsF6YTM5pb5cDUrg1NFnoWmwAAGqLHcKGxPURvSMLXRB9AzpeZHX5V90Nzx8/k6ITQhG2o/fpU1CrPBw=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"cVGkrpP5H4s+vOlYzGYFHX1HccRPI2y3qfBLrD0qpoN2DDbHl0XNLuvTWccF5RiDIhC4i5XYBR7JN2eNjSP7GA=="}],"memo":""}
{"msg":[{"@type":"/vm.m_addpkg","creator":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","package":{"Name":"me","Path":"gno.land/r/albttx/me","Files":[{"Name":"me.gno","Body":"package me\n\nfunc Render(path string) string {\n\treturn `\n# Albttx\n\nHello, i'm @albttx, a Gnopher :v:\n`\n}\n"}]},"deposit":""}],"fee":{"gas_wanted":"800000","gas_fee":"10000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"gvk4xCoHphdaWmnXkKdVcB/fiWhon0bk2Iw0+45HLFBwA7JhNWE+qatU9TCqOGo20Tzvx/Fyqqv/p5A5LBXQZA=="}],"memo":""}
{"msg":[{"@type":"/vm.m_call","caller":"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5","send":"","pkg_path":"gno.land/r/albttx/me","func":"Render","args":[""]}],"fee":{"gas_wanted":"2000000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y"},"signature":"GExT5gt6q4/ZBUq4ixkFJiFJBus9sEhP1VtGLoqGLjNdDo5g6iCW4Wzeu/9JhBdUvkFcl68C40cDc7N6Ae/Izw=="}],"memo":""}
33 changes: 33 additions & 0 deletions misc/loop/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3"
services:
traefik:
image: "traefik:v2.10"
network_mode: host
container_name: "traefik"
command:
- "--api.insecure=true"
- "--providers.file=true"
- "--providers.file.watch=true"
- "--providers.file.directory=/etc/traefik/configs"
- "--entrypoints.web.address=:80"
ports:
- "80:80"
- "8080:8080"
volumes:
- ./traefik:/etc/traefik/configs

snapshotter:
build:
dockerfile: ./snapshotter/Dockerfile
command: ["/usr/sbin/crond", "-l", "2", "-f"]
working_dir: /app
network_mode: host
volumes:
- ./scripts:/scripts
- ./backups:/backups
- ./traefik:/etc/traefik/configs
- "/var/run/docker.sock:/var/run/docker.sock:ro"
environment:
HOST_PWD: $PWD
extra_hosts:
- gno.land:127.0.0.1
32 changes: 16 additions & 16 deletions misc/loop/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ module loop
go 1.20

require (
github.com/gnolang/gno v0.0.0-20231112174927-b1a53c018ea4
github.com/gnolang/gno v0.0.0-20231124185034-aaeb808f18d7
github.com/gnolang/tx-archive v0.1.1
)

require (
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/apd v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dgraph-io/badger/v3 v3.2103.4 // indirect
github.com/dgraph-io/badger/v3 v3.2103.5 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/gnolang/goleveldb v0.0.9 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gnolang/goleveldb v0.1.0 // indirect
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/klauspost/compress v1.17.3 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
Expand All @@ -37,15 +37,15 @@ require (
github.com/rs/cors v1.10.1 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.22.5 // indirect
go.uber.org/multierr v1.10.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/tools v0.16.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)

Expand Down
Loading

0 comments on commit 19eaba4

Please sign in to comment.