Browse Source

Update install.sh

master
yuriy0803 2 years ago committed by GitHub
parent
commit
d611bb1761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 128
      install.sh

128
install.sh

@ -5,19 +5,25 @@ set -x # Enable displaying all commands
echo "Welcome to the installation!" echo "Welcome to the installation!"
# Update and upgrade the package list # Update and upgrade the package list
sudo apt-get update && sudo apt-get upgrade sudo apt-get update && sudo apt-get upgrade -y
# Install npm, rsync, git, redis-server, and nginx # Install npm, rsync, git, redis-server, and nginx
sudo apt-get install npm rsync git redis-server nginx sudo apt-get install npm rsync git redis-server nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
sudo rm -f /etc/nginx/sites-available/default
sudo rm -f /etc/nginx/sites-enabled/default
# Install Node.js Version 14.x # Install Node.js Version 14.x
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
# Download and install Go 1.21.0 # Download and install Go 1.21.0
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz wget https://golang.org/dl/go1.21.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.21.1.linux-amd64.tar.gz
# Create a symbolic link for the Go binary # Create a symbolic link for the Go binary
sudo ln -s /usr/local/go/bin/go /usr/local/bin/go sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
@ -25,46 +31,12 @@ sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
# Get the local IP address of the Linux system # Get the local IP address of the Linux system
ip_address=$(hostname -I | cut -d' ' -f1) ip_address=$(hostname -I | cut -d' ' -f1)
# Configure Nginx
sudo sh -c 'cat > /etc/nginx/sites-available/default <<EOF
# Default server configuration
# nginx example
upstream api {
server 127.0.0.1:8080;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/etc2pool;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /api {
proxy_pass http://127.0.0.1:8080;
}
}
EOF'
# Reload Nginx configuration
sudo systemctl reload nginx
# Build the Go application # Build the Go application
go build go build
# Create modified content with IP address # Create modified content with IP address
modified_content="/* jshint node: true */ modified_content=$(cat <<EOF
/* jshint node: true */
module.exports = function (environment) { module.exports = function (environment) {
var ENV = { var ENV = {
@ -73,67 +45,40 @@ module.exports = function (environment) {
rootURL: '/', rootURL: '/',
locationType: 'hash', locationType: 'hash',
EmberENV: { EmberENV: {
FEATURES: { FEATURES: {}
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
}, },
APP: { APP: {
// API host and port
ApiUrl: '//$ip_address/', ApiUrl: '//$ip_address/',
// HTTP mining endpoint
HttpHost: 'http://$ip_address', HttpHost: 'http://$ip_address',
HttpPort: 8888, HttpPort: 8888,
// Stratum mining endpoint
StratumHost: 'example.net', StratumHost: 'example.net',
StratumPort: 8008, StratumPort: 8008,
// The ETC network
Unit: 'ETC', Unit: 'ETC',
Currency: 'USD', Currency: 'USD',
// Fee and payout details
PoolFee: '1%', PoolFee: '1%',
PayoutThreshold: '0.5 ETC', PayoutThreshold: '0.5 ETC',
BlockReward: 2.56, BlockReward: 2.56,
// For network hashrate (change for your favourite fork)
BlockTime: 13.2 BlockTime: 13.2
} }
}; };
if (environment === 'development') { if (environment === 'development') {
/* Override ApiUrl just for development, while you are customizing ENV.APP.ApiUrl = 'http://localhost:8080/';
frontend markup and css theme on your workstation.
*/
ENV.APP.ApiUrl = 'http://localhost:8080/'
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
} }
if (environment === 'test') { if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none'; ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing'; ENV.APP.rootElement = '#ember-testing';
} }
if (environment === 'production') { if (environment === 'production') {}
}
return ENV; return ENV;
};" };
EOF
)
# Write modified content to environment.js # Write modified content to environment.js
echo "$modified_content" > www/config/environment.js echo "$modified_content" > www/config/environment.js
@ -165,5 +110,42 @@ bash build.sh
# Change back to the main directory # Change back to the main directory
cd .. cd ..
# Nginx configuration
nginx_config=$(cat <<EOF
upstream api {
server 127.0.0.1:8080;
}
server {
listen *:80;
listen [::]:80;
root /var/www/etc2pool;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files \$uri \$uri/ =404;
}
location /api {
proxy_pass http://127.0.0.1:8080;
}
}
EOF
)
# Path to the pool configuration file
pool_config_path="/etc/nginx/sites-available/pool"
# Write the Nginx configuration to the pool configuration file
echo "$nginx_config" | sudo tee "$pool_config_path" > /dev/null
# Create a symbolic link in the sites-enabled directory
sudo ln -s "$pool_config_path" "/etc/nginx/sites-enabled/"
# Restart Nginx to apply the changes
sudo systemctl restart nginx
set +x # Disable displaying commands set +x # Disable displaying commands
echo "Installation completed!" echo "Installation completed!"

Loading…
Cancel
Save