ElementsProject / filebazaar

Sell digital files with Bitcoin & Lightning :zap:
https://blockstream.com/2018/03/22/filebazaar-joins-the-lightning-charge-lapps.html
MIT License
121 stars 27 forks source link

Setup questions #7

Closed chrisguida closed 4 years ago

chrisguida commented 4 years ago

I've got filebazaar installed and running, like so:

$ filebazaar
FileBazaar serving /home/bitcoin/ForSale on port 9678, browse at http://0.0.0.0:9678/

...but when I visit it in my browser, I get a text-only display (rather than a pretty interface as in the readme), and the links don't work. I suppose I have something misconfigured?

_filebazaar.yaml looks like:

---

### Server settings

env: production

#port: 9678
host: 0.0.0.0
#url: http://my-url.com

### Lightning Charge

charge_url: http://localhost:9112
charge_token: SECRET

### FileBazaar settings

# The directory containing the files for sale
# defaults to the directory containing this file
# directory: /path/to/files

# The default file price, can be overridden for individual files (see below)
#default_price: 0.25 USD

# Expiry times
#invoice_ttl: 3600 # lock-in exchange rate for 1 hour
#download_ttl: 172800 # make download available for 2 days after payment

# Secret for generating HMAC access tokens (required)
token_secret: SECRET

# Directory to keep cached preview files
# defaults to `{directory}/_filebazaar_cache`
#cache_path: /path/to/filebazaar_cache

### Looks & feel

# See available themes on https://bootswatch.com
#theme: yeti

# Add custom CSS
#css: |
#  body { background: blue }
#  a { color: orange }

# Set custom views directory
#views_dir: /path/to/custom/views

# Set custom static files directory
#static_dir: /path/to/custom/static

### Files settings

files:
  Books/:
    Mastering-Bitcoin.pdf:
      price: 5 USD
      button: Buy this book

Thanks for your help :)

shesek commented 4 years ago

Are you accessing the webserver through localhost, or is it running on a remote server?

Try setting the url configuration option in _filebazaar.yaml to the same URL you're using to access the web interface with your browser.

chrisguida commented 4 years ago

It's running on an Ubuntu VPS. I did try that, but it's not putting the port number into the url when I click links, so they're going to port 80 instead, which of course isn't listening.

chrisguida commented 4 years ago

Oh hey! I put the port number in the url: field and now the links work and there's a style applied to the website! I guess that's what I was missing :)

chrisguida commented 4 years ago

Sweet! Just sold myself a file! It's working!!

Maybe change the docs to say that if you're hosting on a remote URL to be sure to include [:port] at the end of the url config field?

shesek commented 4 years ago

Awesome! Glad it worked out.

Have you seen the changes in https://github.com/ElementsProject/filebazaar/commit/35674713350285fc5af6576587a4a0d8421951fd (made in response to this issue)? It mentions that the default is http://{host}:{port}/, which hints that you should be including the port number. Do you think that's clear enough, or should I clarify this further?

chrisguida commented 4 years ago

I didn't see that, but no, the problem is that it doesn't default to http://{host}:{port}; it defaults to http://{host}, it seems to be ignoring the value in port.

chrisguida commented 4 years ago

I had to explicitly say http://my-url.com:9678 to get it to work.

shesek commented 4 years ago

This is pretty strange, it definitely looks like it should be adding the port number: https://github.com/ElementsProject/filebazaar/blob/35674713350285fc5af6576587a4a0d8421951fd/src/lib/config.js#L15

It it possible that you had url set in the config file or as the URL environment variable, without the port number?