Code Monkey home page Code Monkey logo

eth-infrastructure's Introduction

eth-infrastructure

configuration of geth, parity, ipfs and nginx to work in a productin environment

Etherium-go (geth)

To launch geth as a service with autorestart

In /etc/systemd/system create a file named gethRopsten.service with:

[Unit]
Description=Geth on ropsten

[Service]
Type=simple
ExecStart=/usr/bin/geth --testnet --rpcport=8548 --datadir "/home/yourUsername/ethereum" --fast --port=30306 --rpc --rpccorsdomain "*" --rpcaddr "0.0.0.0" > /dev/null 2>/home/yourUsername/gethLog
Restart=always


[Install]
WantedBy=multi-user.target

Enable the service

sudo systemctl enable gethropsten

Start the service

sudo systemctl start gethropsten

Parity

To launch parity

nohup parity --chain=ropsten --rpcport=8551 --datadir "/home/username/parity" --port=30309 --dapps-port=8082 --geth > /dev/null 2>/home/username/parityLog &

Nginx

Reverse-proxy

Edit the virtual host etc/nginx/sites-enabled/default and in the end of the server block add:

#geth on test-net
location /BDcHsW5a6RvCHQUJyGFgEAYVGBFP8Hy9v55MP72g/ {
	proxy_pass https://localhost:8548;
	proxy_set_header X-Forwarded-Host $server_name;
	proxy_set_header X-Real-IP $remote_addr;
}

Enabling self-signed https

create a certificate

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Edit the virtual host etc/nginx/sites-enabled/default and add the line

# SSL part
	listen 443 ssl default_server;
	listen [::]:443 ssl ipv6only=on;

# SSL configuration
	ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
	ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

now your etc/nginx/sites-enabled/default should look like

server {

#http part
#       listen 	80 default_server;
#       listen 	[::]:80 default_server;

# SSL part
        listen 	443 ssl default_server;
        listen 	[::]:443 ssl ipv6only=on;

# SSL configuration
        ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
        ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;


#geth on test-net proxy
        location /maDarg9nTJK9VgbGC56kRr440Wu6nglaR7NBYUDk/ {
                proxy_pass http://localhost:8545;
                proxy_set_header X-Forwarded-Host $server_name;
                proxy_set_header X-Real-IP $remote_addr;
                }
#geth on ropsten proxy  
        location /BDcHsW5a6RvCHQUJyGFgEAYVGBFP8Hy9v55MP72g/ {
                proxy_pass http://localhost:8548;
                proxy_set_header X-Forwarded-Host $server_name;
                proxy_set_header X-Real-IP $remote_addr;
                }
#parity Proxy           
        location /u6bC4509vE6IPTNZAzo0VlyrHgaIhvMfX4sNpw3Z/ {
                proxy_pass http://localhost:8551;
                proxy_set_header X-Forwarded-Host $server_name;
                proxy_set_header X-Real-IP $remote_addr;
                }
}

Don't forget to open the ports on ufw

sudo ufw allow 443

IPFS

the easiest way to deal with IPFS is to create a service.

  • create a user for IPF sudo useradd -m ipfs-user
  • launch the command sudo runuser -l ipfs-user -c 'ipfs init' to create the nessesary files.

in /etc/systemd/system create a file named ipfs.service and add the lines:

#!/bin/sh
[Unit]
Description=IPFS daemon
#After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/ipfs daemon
Restart=on-failure
User=ipfs-user

[Install]
WantedBy=multi-user.target

Enable the start at boot sudo systemctl enable ipfs Finally start the service ipfs sudo systemctl start ipfs

eth-infrastructure's People

Contributors

drgorb avatar neptuniux avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

neptuniux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.