Skip to content

Commit

Permalink
Merge pull request #612 from guydavis/integration
Browse files Browse the repository at this point in the history
Version 0.7.0
  • Loading branch information
guydavis authored Mar 11, 2022
2 parents 99a5068 + 70a394f commit 8892c3a
Show file tree
Hide file tree
Showing 119 changed files with 10,068 additions and 749 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ main, integration ]
branches: [ main, integration, development ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, integration ]
branches: [ main, integration, development ]
schedule:
- cron: '25 23 * * 1'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/develop-chia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
push: true
build-args: |
"MACHINARIS_STREAM=develop"
"CHIA_BRANCH=1.2.11"
"CHIA_BRANCH=1.3.0"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris:develop
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris:develop
2 changes: 1 addition & 1 deletion .github/workflows/develop-mmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
build-args: |
"MACHINARIS_STREAM=develop"
"MMX_BRANCH=master"
"CHIA_BRANCH=1.2.11"
"CHIA_BRANCH=1.3.0"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:develop
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:develop
46 changes: 46 additions & 0 deletions .github/workflows/develop-silicoin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: develop-silicoin

on:
push:
branches:
- 'develop'
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
file: docker/dockerfile
context: .
platforms: linux/amd64
push: true
build-args: |
"MACHINARIS_STREAM=develop"
"SILICOIN_BRANCH=main"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:develop
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:develop
2 changes: 1 addition & 1 deletion .github/workflows/main-chia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
push: true
build-args: |
"MACHINARIS_STREAM=latest"
"CHIA_BRANCH=1.2.11"
"CHIA_BRANCH=1.3.0"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris:latest
${{ secrets.DOCKERHUB_USERNAME }}/machinaris:v${{ github.event.inputs.version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-mmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
build-args: |
"MACHINARIS_STREAM=latest"
"MMX_BRANCH=master"
"CHIA_BRANCH=1.2.11"
"CHIA_BRANCH=1.3.0"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:latest
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:v${{ github.event.inputs.version }}
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/main-silicoin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release-silicoin

on:
workflow_dispatch:
inputs:
version:
description: 'Release Version'

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
file: docker/dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
"MACHINARIS_STREAM=latest"
"SILICOIN_BRANCH=main"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:latest
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:v${{ github.event.inputs.version }}
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:latest
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:v${{ github.event.inputs.version }}
2 changes: 1 addition & 1 deletion .github/workflows/test-chia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
push: true
build-args: |
"MACHINARIS_STREAM=test"
"CHIA_BRANCH=1.2.11"
"CHIA_BRANCH=1.3.0"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris:test
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris:test
2 changes: 1 addition & 1 deletion .github/workflows/test-mmx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
build-args: |
"MACHINARIS_STREAM=test"
"MMX_BRANCH=master"
"CHIA_BRANCH=1.2.11"
"CHIA_BRANCH=1.3.0"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:test
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:test
47 changes: 47 additions & 0 deletions .github/workflows/test-silicoin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: test-silicoin

on:
push:
branches:
- 'integration'

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
file: docker/dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
"MACHINARIS_STREAM=test"
"SILICOIN_BRANCH=main"
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:test
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:test
7 changes: 6 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ on:
branches:
- 'develop'

env:
LANG: "en_US.UTF-8"
LANGUAGE: "en_US:en"
LC_ALL: "en_US.UTF-8"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2.3.1
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: Install dependencies
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Known Issues
- Chiadog will sporadically replay alerts when the Machinaris container is restarted. #588
- Coin prices are unavailable from [AllTheBlocks](https://alltheblocks.net), so no fiat conversion in Machinaris currently.

## [0.7.0] - 2022-03-11
- [Chia](https://chia.net) - [v1.3](https://www.reddit.com/r/chia/comments/t95vuk/13_is_live/), please note reports of issues in this new Chia release... double-check your Wallet and Pools settings after upgrading!
- [Internationalization](https://github.com/guydavis/machinaris/wiki/Localization) for locale-specific text, numbers, and currencies. Huge thanks to @antcasq (pt_PT) and @fabriziocacicia (it_IT) for providing translations!
- Geolocation of peer connections for each blockchain by their IP address. [Optionally enabled](https://github.com/guydavis/machinaris/wiki/Connections) using a free Maxmind account.
- [Silicoin](https://github.com/silicoin-network/silicoin-blockchain) - supported again as per Discord votes.

## [0.6.9] - 2022-02-04
- [MMX](https://github.com/madMAx43v3r/mmx-node) - support for this new blockchain, which requires its own plot files.
- [HDDCoin](https://github.com/HDDcoin-Network/hddcoin-blockchain/releases) - update to version 2.0.0
Expand Down
10 changes: 9 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ A huge thank-you to the great teams/devs behind these projects, being used by Ma
* [Toplevel](https://github.com/and-semakin/marshmallow-toplevel): Used for list of objects sent to REST API.
* [DataTables.js](https://datatables.net/): Filter/search/pagination of dynamic tables, as per [this tutorial](https://blog.miguelgrinberg.com/post/beautiful-interactive-tables-for-your-flask-templates).
* [Charts.js](https://www.chartjs.org/): dynamic charting library.
* [Flask-Babel](https://pythonhosted.org/Flask-BabelEx/): internationaliztion and localization, as per [this tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiii-i18n-and-l10n).
* [Leaflet](https://leafletjs.com/): Web mapping toolkit. Fantastic maps, easy to use!
* [Maxmind](https://maxmind.com/): Geolocation API for mapping IP addresses of peer connections.
* [Mapbox](https://mapbox.com): Nice looking map tiles for use with Leaflet on the Connections page map.

## Blockchains
* [BTCgreen](https://github.com/BTCgreen-Network/btcgreen-blockchain)
Expand All @@ -40,8 +44,10 @@ A huge thank-you to the great teams/devs behind these projects, being used by Ma
* [Stor](https://github.com/Stor-Network/stor-blockchain)

## Other Resources
* [Blockchain DB Downloads](https://chiaforksblockchain.com/) - from Maize
* [FD-CLI](https://github.com/Flora-Network/flora-dev-cli) - script to regularly recover 7/8 rewards
* [Chia DB Downloads](https://www.chia-database.com/) - for Chia blockchain database
* [All the Blocks](https://alltheblocks.net/) - blockchain, wallet, and pricing info
* [Coin Gecko](https://coingecko.com/) - fiat currency exchange info

## Testers and Developers

Expand Down Expand Up @@ -90,6 +96,8 @@ A big thanks to all that contributed with dev and test including:
* bafff
* tjb_altf4
* halfroom (aka Sagittarius)
* @antcasq (Antonio Casqueiro)
* @fabriziocacicia

## Trademark Notice
CHIA NETWORK INC, CHIA™, the CHIA BLOCKCHAIN™, the CHIA PROTOCOL™, CHIALISP™ and the “leaf Logo” (including the leaf logo alone when it refers to or indicates Chia), are trademarks or registered trademarks of Chia Network, Inc., a Delaware corporation. *There is no affliation between this Machinaris project and the main Chia Network project.*
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.9
0.7.0
9 changes: 8 additions & 1 deletion api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import logging

from flask import Flask
from flask import Flask, request
from flask_babel import Babel
from flask_migrate import Migrate
from sqlalchemy.engine import Engine
Expand All @@ -32,6 +32,13 @@ def set_sqlite_pragma(dbapi_connection, connection_record):
app.config.from_envvar('API_SETTINGS_FILE', silent=True)
babel = Babel(app)

@babel.localeselector
def get_locale():
#for d in babel.translation_directories:
# app.logger.info(d)
#app.logger.info("API=> Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES'])))
return request.accept_languages.best_match(app.config['LANGUAGES'])

from common.extensions.database import db
migrate = Migrate(app, db)

Expand Down
3 changes: 3 additions & 0 deletions api/babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_
3 changes: 2 additions & 1 deletion api/commands/chia_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import yaml

from flask import Flask, jsonify, abort, request, flash
from flask_babel import _, lazy_gettext as _l
from stat import S_ISREG, ST_CTIME, ST_MTIME, ST_MODE, ST_SIZE
from subprocess import Popen, TimeoutExpired, PIPE, STDOUT
from os import path
Expand Down Expand Up @@ -62,7 +63,7 @@ def save_config(config, blockchain):
writer.write(config)
except Exception as ex:
app.logger.info(traceback.format_exc())
raise Exception('Updated config.yaml failed validation!\n' + str(ex))
raise Exception(_('Updated config.yaml failed validation!') + '\n' + str(ex))
else:
pass

Expand Down
2 changes: 1 addition & 1 deletion api/commands/fd_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def reward_recovery(wallet_id, launcher_id, pool_contract_address):
fd_env = os.environ.copy()
fd_env.update(vars)
cmd = f"/usr/local/bin/fd-cli nft-recover -l {launcher_id} -p {pool_contract_address} -nh 127.0.0.1 -np {rpc_port} -ct {network_path}/config/ssl/full_node/private_full_node.crt -ck {network_path}/config/ssl/full_node/private_full_node.key"
app.logger.info(f"Executing NFT 1/8 win recovery for {blockchain}: {cmd}")
app.logger.info(f"Executing NFT 7/8 win recovery for {blockchain}: {cmd}")
log_fo.write("\n\nExecuted at: {0}\n{1}".format(time.strftime("%Y-%m-%d-%H:%M:%S"), cmd))
log_fo.flush()
proc = Popen(cmd,cwd="/fd-cli", env=fd_env, shell=True, universal_newlines=True, stdout=log_fo, stderr=log_fo)
Expand Down
11 changes: 6 additions & 5 deletions api/commands/pools_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import urllib
import yaml

from flask_babel import _, lazy_gettext as _l
from stat import S_ISREG, ST_CTIME, ST_MTIME, ST_MODE, ST_SIZE
from subprocess import Popen, TimeoutExpired, PIPE
from sqlalchemy import or_
Expand Down Expand Up @@ -64,7 +65,7 @@ def dispatch_action(job):
if msg.strip():
return msg
else:
return "No requested pool modifications were sent. Current settings are unchanged."
return _("No requested pool modifications were sent. Current settings are unchanged.")
else:
raise Exception("Unsupported action {0} for pools.".format(action))

Expand All @@ -79,7 +80,7 @@ def get_pool_login_link(launcher_id):
stream = os.popen("chia plotnft get_login_link -l {0}".format(launcher_id))
return stream.read()
except Exception as ex:
app.logger.error("Failed to get_login_link: {0}".format(str(ex)))
app.logger.debug("Failed to get_login_link: {0}".format(str(ex)))
return ""

def load_plotnft_show(blockchain):
Expand Down Expand Up @@ -147,7 +148,7 @@ def process_pool_leave(blockchain, pool_wallet_id):
for line in stdout_lines:
if "Error" in line:
raise Exception('Error while leaving pool: ' + line)
return 'Successfully left pool, switching to self plotting. Please wait a while to complete, then refresh page. View the log for details.'
return _('Successfully left pool, switching to self-pooling. Please wait a few minutes or more to complete. DO NOT immediately re-submit your request. View the log for details.')

def process_pool_join(blockchain, pool_url, pool_wallet_id):
chia_binary = globals.get_blockchain_binary(blockchain)
Expand Down Expand Up @@ -191,7 +192,7 @@ def process_pool_join(blockchain, pool_url, pool_wallet_id):
for line in stdout_lines:
if "Error" in line:
raise Exception('Error while joining Chia pool. Please double-check pool URL: {0} {1}'.format(pool_url, line))
return 'Successfully joined {0} pool by creating Chia NFT. Please wait a while to complete, then refresh this page. DO NOT immediately re-submit the request. Be patient! View the log for details.'.format(pool_url)
return _('Successfully joined %(pool_url)s pool by creating Chia NFT. Please wait a few minutes or more to complete. DO NOT immediately re-submit your request. Be patient! View the log for details.', pool_url=pool_url)

def process_self_pool(blockchain, pool_wallet_id):
chia_binary = globals.get_blockchain_binary(blockchain)
Expand Down Expand Up @@ -220,4 +221,4 @@ def process_self_pool(blockchain, pool_wallet_id):
for line in stdout_lines:
if "Error" in line:
raise Exception('Error while creating self-pooling NFT: {0}'.format(line))
return 'Successfully created a NFT for self-pooling. Please wait a while to complete, then refresh the page. DO NOT immediately re-submit the request. Be patient! View the log for details.'
return _('Successfully created a NFT for self-pooling. Please wait a few minutes or more to complete. DO NOT immediately re-submit your request. Be patient! View the log for details.')
Loading

0 comments on commit 8892c3a

Please sign in to comment.