This README would normally document whatever steps are necessary to get the application up and running.
Things you may want to cover:
- 2.5.0
- MySQL
- bundler
- TAPYRUS_RPC_USER
- TAPYRUS_RPC_PASSWORD
- TAPYRUS_RPC_HOST
- TAPYRUS_RPC_PORT
- RECAPTCHA_SITE_KEY
- RECAPTCHA_SECRET_KEY
- MYSQL_ROOT_PASSWORD (for development/test)
- SECRET_KEY_BASE (for production)
$ bin/rails secret
$ bin/rails db:create
$ bin/rails db:migrate
- TAPYRUS_FAUCET_DATABASE_PASSWORD
- RAILS_SERVE_STATIC_FILES=1
$ mysql -uroot -p
# mysql> CREATE DATABASE `torifuku_faucet_production`;
mysql> CREATE USER `torifuku_faucet`@localhost IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON `torifuku_faucet_production`.* TO `torifuku_faucet`@localhost IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> exit
$ RAILS_ENV=production bin/rails db:create
$ RAILS_ENV=production bin/rails db:migrate
$ RAILS_ENV=production bin/rails secret # => SECRET_KEY_BASE
[sammy]
$ sudo apt-get update
$ sudo apt-get upgrade
$ cd tapyrus-faucet
$ git pull
$ RAILS_ENV=production bin/rails assets:precompile
$ sudo su -
[root]
$ cd /srv/www
$ cp -r /home/sammy/tapyrus-faucet/public .
$ chown -R nginx public/
$ exit
[sammy]
$ source ~/.profile
$ ps -ef | grep puma
$ kill -9 pid
$ cd tapyrus-faucet
$ nohup bin/rails server -e production -p 3000 &
You can use docker and docker-compose to develop this project. Here is explanation for that. Before do this process, you need to prepare tapyrus-core full node to supply RPC endpoint.
- Build docker image
$ cd project/path
$ docker-compose build
- create
.env
file This is a sample of.env
. You need to specify each environments.
RECAPTCHA_SITE_KEY=xxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
RECAPTCHA_SECRET_KEY=xxxx_xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxx
TAPYRUS_RPC_USER=xxxxx
TAPYRUS_RPC_PASSWORD=xxxxx
TAPYRUS_RPC_HOST=xxxxx.xxxxx.xxxx
TAPYRUS_RPC_PORT=xxxxx
You can get recapture keys from here.
- Create database and migrate it
$ docker-compose up
$ docker-compose run web rails db:create
$ docker-compose run web rails db:migrate
- Access
http://localhost:3000
from any browser
http://localhost:3000
[local]
$ ssh -i ~/.ssh/time4vps -p 50417 sammy@yourhost
[server]
$ sudo su - tapyrus
$ tapyrusd -daemon
$ exit
$ cd ~/tapyrus-faucet
$ nohup bin/rails server -e production -p 3000 &
$ bin/rails test
- nginxの設定
- sslのこと
mysql> SELECT DATE_FORMAT(date, '%Y-%m-%d') AS time, COUNT(*), SUM(value) AS SUM, SUM(value)/COUNT(*) AS AVE FROM `torifuku_faucet_production`.transactions GROUP BY date;