mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-22 10:02:36 +02:00
Added latest configs
This commit is contained in:
parent
6ff00e78cc
commit
891e46b842
@ -6,5 +6,5 @@ COPY ./package.json /app/package.json
|
|||||||
COPY ./yarn.lock /app/yarn.lock
|
COPY ./yarn.lock /app/yarn.lock
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
RUN ./node_modules/.bin/yarn --production
|
RUN ./node_modules/.bin/yarn --production
|
||||||
COPY . /app
|
RUN rm ./*.json ./yarn.lock
|
||||||
RUN tar -zcvf futurebit.tar.gz .
|
RUN tar -zcf ../futurebit.tar.gz .
|
||||||
|
@ -10,7 +10,7 @@ exports.up = async function (knex) {
|
|||||||
await knex.schema.createTable('settings', table => {
|
await knex.schema.createTable('settings', table => {
|
||||||
table.increments('id')
|
table.increments('id')
|
||||||
table.timestamps(false, true)
|
table.timestamps(false, true)
|
||||||
table.enum('miner_mode', ['eco', 'turbo', 'custom']).notNullable()
|
table.enum('miner_mode', ['eco', 'balanced', 'turbo', 'custom']).notNullable()
|
||||||
table.float('voltage').notNullable()
|
table.float('voltage').notNullable()
|
||||||
table.integer('frequency').notNullable()
|
table.integer('frequency').notNullable()
|
||||||
table.integer('fan').notNullable()
|
table.integer('fan').notNullable()
|
||||||
@ -19,6 +19,7 @@ exports.up = async function (knex) {
|
|||||||
table.boolean('left_sidebar_extended').notNullable()
|
table.boolean('left_sidebar_extended').notNullable()
|
||||||
table.boolean('right_sidebar_visibility').notNullable()
|
table.boolean('right_sidebar_visibility').notNullable()
|
||||||
table.enum('temperature_unit', ['f', 'c']).notNullable()
|
table.enum('temperature_unit', ['f', 'c']).notNullable()
|
||||||
|
table.boolean('custom_approval').notNull().defaultTo(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
// default settings
|
// default settings
|
||||||
@ -39,12 +40,23 @@ exports.up = async function (knex) {
|
|||||||
table.increments('id')
|
table.increments('id')
|
||||||
table.timestamps(false, true)
|
table.timestamps(false, true)
|
||||||
table.boolean('enabled').notNullable()
|
table.boolean('enabled').notNullable()
|
||||||
|
table.integer('donation').notNullable()
|
||||||
table.text('url').notNullable()
|
table.text('url').notNullable()
|
||||||
table.text('username')
|
table.text('username')
|
||||||
table.text('password')
|
table.text('password')
|
||||||
table.text('proxy')
|
table.text('proxy')
|
||||||
table.integer('index').notNullable()
|
table.integer('index').notNullable()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// default pool
|
||||||
|
await knex('pools').insert({
|
||||||
|
enabled: true,
|
||||||
|
donation: 1,
|
||||||
|
url: 'stratum+tcp://us.litecoinpool.org:3333',
|
||||||
|
username: 'jstefanop.x2',
|
||||||
|
password: 'x',
|
||||||
|
index: 0
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.down = async function (knex) {
|
exports.down = async function (knex) {
|
||||||
|
@ -5,4 +5,4 @@ APP_PATH="$SCRIPT_PATH/.."
|
|||||||
|
|
||||||
mkdir -p "$APP_PATH/build" && \
|
mkdir -p "$APP_PATH/build" && \
|
||||||
docker build $APP_PATH -t orange && \
|
docker build $APP_PATH -t orange && \
|
||||||
docker run --rm -v "${APP_PATH}":/hostdir orange /bin/bash -c "cp ./futurebit.tar.gz /hostdir/build"
|
docker run --rm -v "${APP_PATH}":/hostdir orange /bin/bash -c "cp ../futurebit.tar.gz /hostdir/build"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT && \
|
iptables -A INPUT -p tcp --dport 80 -j ACCEPT && \
|
||||||
iptables -A INPUT -i eth0 -p tcp --dport 5000 -j ACCEPT && \
|
iptables -A INPUT -p tcp --dport 5000 -j ACCEPT && \
|
||||||
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000
|
iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 5000
|
@ -31,6 +31,8 @@ LOADAVG=$(cat /proc/loadavg)
|
|||||||
ARCHITECTURE=$(uname -m)
|
ARCHITECTURE=$(uname -m)
|
||||||
TEMP=$(cat /sys/class/thermal/thermal_zone*/temp)
|
TEMP=$(cat /sys/class/thermal/thermal_zone*/temp)
|
||||||
ACTIVE_WIFI=$(nmcli -t c show --active | grep wireless | cut -d":" -f1)
|
ACTIVE_WIFI=$(nmcli -t c show --active | grep wireless | cut -d":" -f1)
|
||||||
|
MINER_TEMP=$(cat /var/local/apollo/hwmon/pcb_temp)
|
||||||
|
MINER_FAN_SPEED=$(cat /var/local/apollo/hwmon/fan_speed)
|
||||||
|
|
||||||
# Memory
|
# Memory
|
||||||
memTotal=$(egrep '^MemTotal:' /proc/meminfo | awk '{print $2}')
|
memTotal=$(egrep '^MemTotal:' /proc/meminfo | awk '{print $2}')
|
||||||
@ -60,6 +62,8 @@ JSON="{
|
|||||||
\"loadAverage\": \"$LOADAVG\",
|
\"loadAverage\": \"$LOADAVG\",
|
||||||
\"architecture\": \"$ARCHITECTURE\",
|
\"architecture\": \"$ARCHITECTURE\",
|
||||||
\"temperature\": \"$TEMP\",
|
\"temperature\": \"$TEMP\",
|
||||||
|
\"minerTemperature\": \"MINER_TEMP\",
|
||||||
|
\"minerFanSpeed\": \"MINER_FAN_SPEED\",
|
||||||
\"activeWifi\": \"$ACTIVE_WIFI\",
|
\"activeWifi\": \"$ACTIVE_WIFI\",
|
||||||
\"memory\":
|
\"memory\":
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,8 @@ cat << EOF
|
|||||||
"loadAverage": "0.00 0.00 0.00 1/120 2859",
|
"loadAverage": "0.00 0.00 0.00 1/120 2859",
|
||||||
"architecture": "armv7l",
|
"architecture": "armv7l",
|
||||||
"temperature": "40656",
|
"temperature": "40656",
|
||||||
|
"minerTemperature": "76",
|
||||||
|
"minerFanSpeed": "4567",
|
||||||
"activeWifi": "befree",
|
"activeWifi": "befree",
|
||||||
"memory":
|
"memory":
|
||||||
{
|
{
|
||||||
|
@ -73,17 +73,47 @@ const generate = async function (pools = null, settings = null ) {
|
|||||||
'ALL'
|
'ALL'
|
||||||
],
|
],
|
||||||
'set-device' : [
|
'set-device' : [
|
||||||
'APL:clock=' + settings.frequency,
|
'APL:clock=' + settings.frequency
|
||||||
'APL:voltage=' + settings.voltage,
|
|
||||||
'APL:mode=' + settings.minerMode,
|
|
||||||
'APL:fan=' + settings.fan
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const confDir = (process.env.NODE_ENV === 'production') ? '/var/local/apollo/hwmon' : '/tmp/hwmon';
|
||||||
|
let minerMode = 0;
|
||||||
|
|
||||||
|
switch (settings.minerMode) {
|
||||||
|
case 'eco':
|
||||||
|
minerMode = 1
|
||||||
|
break;
|
||||||
|
case 'balanced':
|
||||||
|
minerMode = 2
|
||||||
|
break;
|
||||||
|
case 'turbo':
|
||||||
|
minerMode = 3
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
minerMode = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
const voltageStep = parseInt((settings.voltage - 644) / 4.15);
|
||||||
|
|
||||||
|
// Write all configuration files
|
||||||
|
// Bfgminer
|
||||||
fs.writeFile('/opt/bfgminer.conf', JSON.stringify(configuration, null, 4), (err) => {
|
fs.writeFile('/opt/bfgminer.conf', JSON.stringify(configuration, null, 4), (err) => {
|
||||||
// console.log(configuration);
|
// Conf dir
|
||||||
|
fs.mkdir(confDir, { recursive: true }, (err) => {
|
||||||
|
// Mode
|
||||||
|
fs.writeFile(confDir + '/hwmon_state', minerMode, (err) => {
|
||||||
|
// Fan
|
||||||
|
fs.writeFile(confDir + '/fan_speed', settings.fan, (err) => {
|
||||||
|
// Voltage
|
||||||
|
fs.writeFile(confDir + '/reg_voltage', parseInt(voltageStep), (err) => {
|
||||||
console.log('Configuration saved');
|
console.log('Configuration saved');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = generate;
|
module.exports = generate;
|
@ -19,7 +19,9 @@ module.exports.typeDefs = `
|
|||||||
uptime: String
|
uptime: String
|
||||||
loadAverage: String,
|
loadAverage: String,
|
||||||
architecture: String
|
architecture: String
|
||||||
temperature: String
|
temperature: Int
|
||||||
|
minerTemperature: Int
|
||||||
|
minerFanSpeed: Int
|
||||||
activeWifi: String
|
activeWifi: String
|
||||||
memory: MemoryStats
|
memory: MemoryStats
|
||||||
cpu: CpuStats
|
cpu: CpuStats
|
||||||
|
@ -6,6 +6,7 @@ module.exports.typeDefs = `
|
|||||||
type Pool {
|
type Pool {
|
||||||
id: Int!
|
id: Int!
|
||||||
enabled: Boolean!
|
enabled: Boolean!
|
||||||
|
donation: Int
|
||||||
url: String!
|
url: String!
|
||||||
username: String
|
username: String
|
||||||
password: String
|
password: String
|
||||||
|
@ -5,6 +5,7 @@ module.exports.typeDefs = `
|
|||||||
|
|
||||||
input PoolCreateInput {
|
input PoolCreateInput {
|
||||||
enabled: Boolean!
|
enabled: Boolean!
|
||||||
|
donation: Int
|
||||||
url: String!
|
url: String!
|
||||||
username: String
|
username: String
|
||||||
password: String
|
password: String
|
||||||
|
@ -6,6 +6,7 @@ module.exports.typeDefs = `
|
|||||||
input PoolUpdateInput {
|
input PoolUpdateInput {
|
||||||
id: Int!
|
id: Int!
|
||||||
enabled: Boolean
|
enabled: Boolean
|
||||||
|
donation: Int
|
||||||
url: String
|
url: String
|
||||||
username: String
|
username: String
|
||||||
password: String
|
password: String
|
||||||
|
@ -5,6 +5,7 @@ module.exports.typeDefs = `
|
|||||||
|
|
||||||
input PoolUpdateAllInputItem {
|
input PoolUpdateAllInputItem {
|
||||||
index: Int!
|
index: Int!
|
||||||
|
donation: Int
|
||||||
enabled: Boolean!
|
enabled: Boolean!
|
||||||
url: String!
|
url: String!
|
||||||
username: String
|
username: String
|
||||||
|
@ -3,7 +3,7 @@ module.exports.typeDefs = `
|
|||||||
Settings: SettingsActions
|
Settings: SettingsActions
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MinerMode { eco, turbo, custom }
|
enum MinerMode { eco, balanced, turbo, custom }
|
||||||
enum TemperatureUnit { f, c }
|
enum TemperatureUnit { f, c }
|
||||||
|
|
||||||
type Settings {
|
type Settings {
|
||||||
@ -13,6 +13,7 @@ module.exports.typeDefs = `
|
|||||||
voltage: Float!
|
voltage: Float!
|
||||||
frequency: Int!
|
frequency: Int!
|
||||||
fan: Int!
|
fan: Int!
|
||||||
|
customApproval: Boolean
|
||||||
connectedWifi: String
|
connectedWifi: String
|
||||||
leftSidebarVisibility: Boolean!
|
leftSidebarVisibility: Boolean!
|
||||||
leftSidebarExtended: Boolean!
|
leftSidebarExtended: Boolean!
|
||||||
|
@ -8,6 +8,7 @@ module.exports.typeDefs = `
|
|||||||
voltage: Float,
|
voltage: Float,
|
||||||
frequency: Int,
|
frequency: Int,
|
||||||
fan: Int
|
fan: Int
|
||||||
|
customApproval: Boolean
|
||||||
connectedWifi: String
|
connectedWifi: String
|
||||||
leftSidebarVisibility: Boolean
|
leftSidebarVisibility: Boolean
|
||||||
leftSidebarExtended: Boolean
|
leftSidebarExtended: Boolean
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const updateFields = {
|
const updateFields = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
enabled: 'enabled',
|
enabled: 'enabled',
|
||||||
|
donation: 'donation',
|
||||||
url: 'url',
|
url: 'url',
|
||||||
username: 'username',
|
username: 'username',
|
||||||
password: 'password',
|
password: 'password',
|
||||||
|
@ -16,6 +16,7 @@ module.exports = ({ define }) => {
|
|||||||
readQ.select(
|
readQ.select(
|
||||||
'id',
|
'id',
|
||||||
'enabled',
|
'enabled',
|
||||||
|
'donation',
|
||||||
'url',
|
'url',
|
||||||
'username',
|
'username',
|
||||||
'password',
|
'password',
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const updateFields = {
|
const updateFields = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
enabled: 'enabled',
|
enabled: 'enabled',
|
||||||
|
donation: 'donation',
|
||||||
url: 'url',
|
url: 'url',
|
||||||
username: 'username',
|
username: 'username',
|
||||||
password: 'password',
|
password: 'password',
|
||||||
|
@ -20,6 +20,7 @@ module.exports = ({ define }) => {
|
|||||||
'voltage',
|
'voltage',
|
||||||
'frequency',
|
'frequency',
|
||||||
'fan',
|
'fan',
|
||||||
|
'custom_approval as customApproval',
|
||||||
'connected_wifi as connectedWifi',
|
'connected_wifi as connectedWifi',
|
||||||
'left_sidebar_visibility as leftSidebarVisibility',
|
'left_sidebar_visibility as leftSidebarVisibility',
|
||||||
'left_sidebar_extended as leftSidebarExtended',
|
'left_sidebar_extended as leftSidebarExtended',
|
||||||
|
@ -5,6 +5,7 @@ module.exports = ({ define }) => {
|
|||||||
'voltage',
|
'voltage',
|
||||||
'frequency',
|
'frequency',
|
||||||
'fan',
|
'fan',
|
||||||
|
'custom_approval as customApproval',
|
||||||
'connected_wifi as connectedWifi',
|
'connected_wifi as connectedWifi',
|
||||||
'left_sidebar_visibility as leftSidebarVisibility',
|
'left_sidebar_visibility as leftSidebarVisibility',
|
||||||
'left_sidebar_extended as leftSidebarExtended',
|
'left_sidebar_extended as leftSidebarExtended',
|
||||||
|
@ -3,6 +3,7 @@ const updateFields = {
|
|||||||
voltage: 'voltage',
|
voltage: 'voltage',
|
||||||
frequency: 'frequency',
|
frequency: 'frequency',
|
||||||
fan: 'fan',
|
fan: 'fan',
|
||||||
|
'customApproval': 'custom_approval',
|
||||||
connectedWifi: 'connected_wifi',
|
connectedWifi: 'connected_wifi',
|
||||||
leftSidebarVisibility: 'left_sidebar_visibility',
|
leftSidebarVisibility: 'left_sidebar_visibility',
|
||||||
leftSidebarExtended: 'left_sidebar_extended',
|
leftSidebarExtended: 'left_sidebar_extended',
|
||||||
|
Loading…
Reference in New Issue
Block a user