Author Topic: help with faucet  (Read 5415 times)

0 Members and 1 Guest are viewing this topic.

Offline roadscape

Thanks for the response roadscape.  I am a complete and utter noob at this.  I am not exactly sure what you are asking by how do I launch the server.  I am following xerocs instructions here http://docs.bitshares.eu////testnet/7-faucet.html  I would be lying if I said I understood everything that I was typing into the terminal. 

From what little I do understand I think its mina deploy that should be selecting the proper environment and isn't.  The only other command that looks like it could be starting the server is sudo service nginx start. 

I switched over to the bitshares_faucet db and added dele-puppy.com to allowed_domains.  There is no important info in the databases, and I have no problem with wiping them.  I can add someones ssh key so they can ssh in directly if that would be better than trying to translate through me.

I've not used mina, but yes it's probably responsible for setting the environment. There's a lot of moving parts here and in the instructions I see some things that may need to be tweaked. So perhaps the best way to move forward here is to follow these instructions to set up a faucet and see for myself what's going on. From your web wallet, would you be able to switch the faucet over to my test one temporarily? Or do they need to be on the same domain?
http://cryptofresh.com  |  witness: roadscape

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
Thanks for the response roadscape.  I am a complete and utter noob at this.  I am not exactly sure what you are asking by how do I launch the server.  I am following xerocs instructions here http://docs.bitshares.eu////testnet/7-faucet.html  I would be lying if I said I understood everything that I was typing into the terminal. 

From what little I do understand I think its mina deploy that should be selecting the proper environment and isn't.  The only other command that looks like it could be starting the server is sudo service nginx start. 

I switched over to the bitshares_faucet db and added dele-puppy.com to allowed_domains.  There is no important info in the databases, and I have no problem with wiping them.  I can add someones ssh key so they can ssh in directly if that would be better than trying to translate through me.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline roadscape

Try:

RAILS_ENV=production bundle exec rake db:create db:schema:load

I do that when I set up the faucet.  I do it in the faucet directory though.  In fact the only way I could get the bitshares_faucet db to load as opposed to the bitshares_faucet_dev db is to modify the faucet/config/database.yml file.  For some reason it is loading the development branch, and I don't know what I am doing wrong.

I have a real secret under my develop branch in my secrets.yml file.  Other than that there wouldn't be any security issues from my faucet running the bitshares_faucet_dev db would there?

Please note that it's production/dev/test 'environment' not 'branch'. It's just a bit confusing to read :)

Rails by default is in the development environment. When you run take tasks, they're in the dev environment too.

bundle exec rake db:create db:schema:load <-- this sets up a development db
RAILS_ENV=production bundle exec rake db:create db:schema:load <-- this sets up a production db

rails s <-- this will start a server using development config
RAILS_ENV=production rails s <-- server will use production config

The secrets.yml file you don't need to worry about.

But if you're connecting to the development database, you're probably running in the development environment. And that is a security risk because it reveals a lot of information to make debugging easier.

We should get your faucet running in the production environment and connecting to the production database. What command are you using to start the server? And please verify that the "allowed_domains" entry was added to the production db.

Do you have any important information in the databases or can they still be wiped at this point?
http://cryptofresh.com  |  witness: roadscape

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
Try:

RAILS_ENV=production bundle exec rake db:create db:schema:load

I do that when I set up the faucet.  I do it in the faucet directory though.  In fact the only way I could get the bitshares_faucet db to load as opposed to the bitshares_faucet_dev db is to modify the faucet/config/database.yml file.  For some reason it is loading the development branch, and I don't know what I am doing wrong.

I have a real secret under my develop branch in my secrets.yml file.  Other than that there wouldn't be any security issues from my faucet running the bitshares_faucet_dev db would there? 
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Try:

RAILS_ENV=production bundle exec rake db:create db:schema:load

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
go to /www/current and run
rails db
then run

insert into widgets set allowed_domains='testnet.bitshares.eu';

I should add this to the docs as well :)

I did that rails db command when Valzav helped merivercap fix the faucet for bts.bitcash.org.  I hadn't done it in the /www/current directory though.  I had just done it in the faucet dir.  Running it in the correct directory fixed the widget issue, but  I'm still having issues, in fact now my faucet isn't registering accounts at all.  I probably messed something up when I was diggingh around in the mysql database.  The browser console is now saying
Code: [Select]
Warning! faucet registration failed, falling back to direct application_api.create_account.. app.js:63:26532
ERROR AccountActions.createAccount Error: value required for registrar_id: null
Stack trace:
e.exports.required@https://dele-puppy.com/wallet/app.js:62:30878
v</<.value@https://dele-puppy.com/wallet/app.js:63:21890
z</<.value/c@https://dele-puppy.com/wallet/app.js:63:25616
z</<.value/<@https://dele-puppy.com/wallet/app.js:63:26640

I probably messed things up when I was trying to fix the other error.

edit.  NM.  It looks like the cli_wallet just wasn't connecting for some reason.  After relaunching it I am back to square 1.  Able to register with the faucet but not with a referrer.  production log shows (this is a screen grab from nano, so the long lines are cut off)
Code: [Select]
I, [2016-03-24T17:31:32.066767 #22710]  INFO -- : Started POST "/api/v1/accounts" for <ip redacted> at 2016-03-24 17:31:32 -0400
I, [2016-03-24T17:31:32.072970 #22710]  INFO -- : Processing by Api::V1::AccountsController#create as JSON
I, [2016-03-24T17:31:32.073077 #22710]  INFO -- :   Parameters: {"account"=>{"name"=>"test-puppies-0", "owner_key"=>"BTS8Lzrh1BGHodkZTsgHys1KZoq1zduh5CYboggzqGtTLXcE2bAJk", "active_key"=>"BTS6LGzWJSffndeYKHNaG4keSUSUE48FPLZAeS8TE2VoigAus9b4z", "memo_key"=>"BTS6LGzWJSffn$
D, [2016-03-24T17:31:32.095777 #22710] DEBUG -- :   ^[[1m^[[36m (0.2ms)^[[0m  ^[[1mBEGIN^[[0m
D, [2016-03-24T17:31:32.105458 #22710] DEBUG -- :   ^[[1m^[[35mBtsAccount Exists (0.5ms)^[[0m  SELECT  1 AS one FROM `bts_accounts` WHERE `bts_accounts`.`remote_ip` = BINARY '<ip redacted>' AND (created_at > '2016-03-24 17:26:32') LIMIT 1
I, [2016-03-24T17:31:32.106557 #22710]  INFO -- : ---- Registering account: 'test-puppies-0' BTS6LGzWJSffndeYKHNaG4keSUSUE48FPLZAeS8TE2VoigAus9b4z/BTS8Lzrh1BGHodkZTsgHys1KZoq1zduh5CYboggzqGtTLXcE2bAJk referrer:
I, [2016-03-24T17:31:32.107062 #22710]  INFO -- : call: [0, "get_account", ["test-puppies-0"]]
E, [2016-03-24T17:31:32.149399 #22710] ERROR -- : Websocket RPC Error: {"code"=>1, "message"=>"10 assert_exception: Assert Exception\nrec && rec->name == account_name_or_id: \n    {}\n    th_a  wallet.cpp:597 get_account", "data"=>{"code"=>10, "name"=>"assert_exception"$
I, [2016-03-24T17:31:32.150292 #22710]  INFO -- : call: [0, "register_account", ["test-puppies-0", "BTS6LGzWJSffndeYKHNaG4keSUSUE48FPLZAeS8TE2VoigAus9b4z", "BTS8Lzrh1BGHodkZTsgHys1KZoq1zduh5CYboggzqGtTLXcE2bAJk", "dele-puppy-reg", "dele-puppy-reg", 0, true]]
D, [2016-03-24T17:31:32.253547 #22710] DEBUG -- : {"ref_block_num"=>10930, "ref_block_prefix"=>1598310984, "expiration"=>"2016-03-24T21:32:00", "operations"=>[[5, {"fee"=>{"amount"=>1483385, "asset_id"=>"1.3.0"}, "registrar"=>"1.2.101323", "referrer"=>"1.2.101323", "ref$
D, [2016-03-24T17:31:32.256441 #22710] DEBUG -- :   ^[[1m^[[36mSQL (0.7ms)^[[0m  ^[[1mINSERT INTO `bts_accounts` (`name`, `owner_key`, `active_key`, `memo_key`, `remote_ip`, `created_at`, `updated_at`) VALUES ('test-puppies-0', 'BTS8Lzrh1BGHodkZTsgHys1KZoq1zduh5CYboggzq$
D, [2016-03-24T17:31:32.258998 #22710] DEBUG -- :   ^[[1m^[[35m (1.4ms)^[[0m  COMMIT
I, [2016-03-24T17:31:32.274106 #22710]  INFO -- :   Rendered api/v1/accounts/show.json.jbuilder (10.8ms)
I, [2016-03-24T17:31:32.274646 #22710]  INFO -- : Completed 201 Created in 201ms (Views: 15.1ms | ActiveRecord: 3.9ms)
I, [2016-03-24T17:33:37.223953 #22710]  INFO -- : Started GET "/" for 66.249.79.247 at 2016-03-24 17:33:37 -0400
I, [2016-03-24T17:33:37.225372 #22710]  INFO -- : Processing by WalletController#index as HTML
I, [2016-03-24T17:33:37.226837 #22710]  INFO -- :   Rendered wallet/index.html.erb (0.1ms)
I, [2016-03-24T17:33:37.227106 #22710]  INFO -- : Completed 200 OK in 2ms (Views: 0.7ms | ActiveRecord: 0.0ms)
I, [2016-03-24T17:33:56.439781 #22710]  INFO -- : Started GET "/?r=dele-puppy" for <ip redacted> at 2016-03-24 17:33:56 -0400
I, [2016-03-24T17:33:56.441443 #22710]  INFO -- : Processing by WalletController#index as HTML
I, [2016-03-24T17:33:56.441506 #22710]  INFO -- :   Parameters: {"r"=>"dele-puppy"}
I, [2016-03-24T17:33:56.443207 #22710]  INFO -- :   Rendered wallet/index.html.erb (0.1ms)
I, [2016-03-24T17:33:56.443668 #22710]  INFO -- : Completed 200 OK in 2ms (Views: 0.9ms | ActiveRecord: 0.0ms)
I, [2016-03-24T17:33:57.167088 #22710]  INFO -- : Started GET "/widgets/1/w.js?ref=" for <ip redacted> at 2016-03-24 17:33:57 -0400
I, [2016-03-24T17:33:57.168434 #22710]  INFO -- : Processing by WidgetsController#w as JS
I, [2016-03-24T17:33:57.168508 #22710]  INFO -- :   Parameters: {"ref"=>"", "widget_id"=>"1"}
D, [2016-03-24T17:33:57.169852 #22710] DEBUG -- :   ^[[1m^[[36mWidget Load (0.2ms)^[[0m  ^[[1mSELECT  `widgets`.* FROM `widgets` WHERE `widgets`.`id` = 1 LIMIT 1^[[0m
I, [2016-03-24T17:33:57.170397 #22710]  INFO -- : Completed 404 Not Found in 2ms (ActiveRecord: 0.2ms)
F, [2016-03-24T17:33:57.171202 #22710] FATAL -- :
ActiveRecord::RecordNotFound (Couldn't find Widget with 'id'=1):
  app/controllers/widgets_controller.rb:9:in `w'

rails db from the /www/current directory returns
Code: [Select]
mysql> select allowed_domains from widgets;
+-----------------+
| allowed_domains |
+-----------------+
| localhost       |
| dele-puppy.com  |
+-----------------+
2 rows in set (0.00 sec)
I think it might have something to do with the wrong database loading.  status shows
Code: [Select]
mysql> status
--------------
/usr/bin/mysql  Ver 14.14 Distrib 5.5.47, for debian-linux-gnu (x86_64) using readline 6.3

Connection id: 416
Current database: bitshares_faucet_dev
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.47-0ubuntu0.14.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db     characterset: utf8
Client characterset: utf8
Conn.  characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 35 days 22 hours 55 min 58 sec

Threads: 3  Questions: 11019  Slow queries: 2  Opens: 348  Flush tables: 1  Open tables: 57  Queries per second avg: 0.003
--------------

Perhaps this is related to an issue in my environment that is causing the bitshares_faucet_dev db to load rather than the bitshares_faucet db.  I am just spitballing here though, as I stated earlier if I was a super hero my name would be supernoob, cause I really have no idea what I am doing.  Any assistance is appreciated.  If nothing else I am building a new faucet on a new server.  I'll see if I have the same issues on that server.
« Last Edit: March 24, 2016, 09:46:32 pm by puppies »
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
go to /www/current and run
rails db
then run

insert into widgets set allowed_domains='testnet.bitshares.eu';

I should add this to the docs as well :)

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
Make sure you have a record in widgets table with allowed_domains='dele-puppy.com' and id=1.
And place the following into your index.html before closing body tag:
Code: [Select]
  <script>
      var BTSW = window.BTSW || {};
      (function () {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.async = true;
        script.src = '/widgets/1/w.js?ref=' + encodeURIComponent(document.referrer);
        var entry = document.getElementsByTagName('script')[0];
        entry.parentNode.insertBefore(script, entry);
      }());
    </script>

Thanks a million.  I'll give that a shot as soon as I figure out how.  Here comes google to the rescue.
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline valzav

  • Sr. Member
  • ****
  • Posts: 294
    • View Profile
Make sure you have a record in widgets table with allowed_domains='dele-puppy.com' and id=1.
And place the following into your index.html before closing body tag:
Code: [Select]
  <script>
      var BTSW = window.BTSW || {};
      (function () {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.async = true;
        script.src = '/widgets/1/w.js?ref=' + encodeURIComponent(document.referrer);
        var entry = document.getElementsByTagName('script')[0];
        entry.parentNode.insertBefore(script, entry);
      }());
    </script>

Offline valzav

  • Sr. Member
  • ****
  • Posts: 294
    • View Profile
Make sure you have a record in widgets table with allowed_domains='dele-puppy.com'.
And place the following into your index.html before closing body tag:
Code: [Select]
  <script>
      var BTSW = window.BTSW || {};
      (function () {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.async = true;
        script.src = '/widgets/1/w.js?ref=' + encodeURIComponent(document.referrer);
        var entry = document.getElementsByTagName('script')[0];
        entry.parentNode.insertBefore(script, entry);
      }());
    </script>

Offline puppies

  • Hero Member
  • *****
  • Posts: 1659
    • View Profile
  • BitShares: puppies
Could you check to see if there is a _referer_ variable in the faucet cookie?

It is most likely an issue with either writing or reading the cookie.
I am not sure how to check the cookie
Have you seen the tutorial that I put up for the testnet?
http://docs.bitshares.eu/testnet/public-testnet-howto.html

From here, I can't tell what the issue is ut it seems to be related to
Quote
F, [2016-03-21T16:07:23.066696 #15512] FATAL -- :
ActionController::RoutingError (No route matches [POST] "/"):
How did you 'deploy' the faucet and how is it run?
Thanks Xeroc, I actually used your how to to set up dele-puppy.com including setting up the faucet.  I used the mina commands in your how to do deploy the faucet and the wallet.

I also set up the wallet and faucet for bts.bitcash.org and we had a similar problem with referrals not working.  Valentine helped fix that issue, and if I recall correctly it was a database issue.  He had to go into 'rails db' and change something.  I am the super noob at mysql and rails though.

Perhaps I will create a new server and create the faucet from scratch to see if I can get it working that way. 
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
Quote
Code: [Select]
call: [0, "register_account", ["puppies-test-2", "BTS5abB7845TM3GSq1ExiWDEU7wKZFEfZJTYTDQ94h4cnZioiMbW1", "BTS59wWKYExLCfAnU7LdpWHHrVjaA5XDgTXjhofcRw7RhcomTSYcC", "dele-puppy-reg", "dele-puppy-reg", 0, true
This line of log means no referrer is set.
BitShares committee member: abit
BitShares witness: in.abit

Offline roadscape

The RoutingError looks to me unrelated.

Line 3 of the log contains

Parameters: {"account"=>{"name"=>"puppies-test-2",
"owner_key"=>"BTS59w....YcC", "active_key"=>"BTS5a....MbW1",
"memo_key"=>"BTS5ab...MbW1", "refcode"=>nil}}

 so I think the real bug is early in the process
http://cryptofresh.com  |  witness: roadscape

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Have you seen the tutorial that I put up for the testnet?
http://docs.bitshares.eu/testnet/public-testnet-howto.html

From here, I can't tell what the issue is ut it seems to be related to
Quote
F, [2016-03-21T16:07:23.066696 #15512] FATAL -- :
ActionController::RoutingError (No route matches [POST] "/"):
How did you 'deploy' the faucet and how is it run?

Offline roadscape

Could you check to see if there is a _referer_ variable in the faucet cookie?

It is most likely an issue with either writing or reading the cookie.
http://cryptofresh.com  |  witness: roadscape