Skip to content

Tutorial: how to run Hydro scaffold on a $5 linode Server

T edited this page Aug 7, 2020 · 2 revisions

Part 1: Local setup

The first part is to get a relayer running on the local machine. Once we get the scaffold running, we'll setup a react development environment and make some simple UI changes. Then we'll commit our UI modifications and deploy it to a production server.

  1. Fork the https://github.com/HydroProtocol/hydro-box-dex repository. (You need a github account for this part)
    1. [Image: Screen Shot 2019-05-02 at 9.37.52 AM.png]
  2. Once you fork the repository, clone it to your local development computer
  3. Follow the README instruction to spin up a running hydro relayer via docker-compose

Part 2: setup react and make UI changes

Setup React

  • The hydro-box-dex immediately works, and there are options to rebuild from source. However, docker is not the best way to make UI changes. We will 1) take the web component out of the docker-compose, and 2) setup a local react dev instance:
    • docker-compose down
    • open docker-compose.yml and comment out the web: section
      • web: image: hydroprotocolio/hydro-box-dex-web:latest container_name: hydro-box-dex-web ports: - 3000:8043
    • docker-compose up
  • now go into the /web directory via: cd web
  • follow the “How to develop” instruction in the web/README.me file or just type:
    • npm install
    • npm run start
  • Open localhost:3000 and you should see the relayer UI again, except now it's no longer running via docker, but just react
  • Now let's make an obvious change, open web/src/index.scss and change the font-size in the body from 14px to 34px. The change should immediately live-update in your browser.

Part 2: Linode setup

  • Register an account at https://www.linode.com/, you need to link a credit card for $5 payment

  • Create a Linode. I used Ubuntu 18.04 LTS, but feel free to choose your favorite linux flavor

  • Choose a region closest to you

  • The smallest and cheapest server is Nanode 1GB($5/month)

    • [Image: Screen Shot 2019-05-02 at 9.41.27 AM.png]
  • Choose a password, which is needed for SSH remote login and installation

  • For more info refer to the first part of this guide: https://www.linode.com/docs/getting-started

Part 3: ssh and account setup

Part 4: install docker on your linode

Part 5: deployment

  • Login to your linode account via ssh

  • go to the home directory

  • clone https://github.com/HydroProtocol/hydro-box-dex

  • open docker-compose.yaml

    • Under web: and the nested environment: section, change the IP address from localhost to the IP of your linode server
    • [Image: Screen Shot 2019-05-02 at 9.52.10 AM.png]
  • Follow the instruction as you did on localhost, by running

    • ``docker-compose pull && docker-compose up -d`
  • visit http://{your-ip}:3000 and you should see a running

Part 6: misc optimizations

  • Setup a domain name (TODO)
    • buy a domain
    • change the DNS to point to your server
  • Setup nginx: one way to host your Hydro relay on port 80 instead of 3000
  • Setup ssl via cloudflare

Part 7: operations

Clone this wiki locally