Skip to content

SahidMiller/HttpFlipstarterServer

Repository files navigation

Flipstarter

Flipstarter provides a way for any project to engage with potential funders in a way that encourages accountability for projects and fairness for funders.

The Flipstarter team has created these tools for anyone to use. Although we have worked hard to make Flipstarter easy to deploy and reliable to operate, the tools are offered as-is with no expectation of support. If you are not confident about your ability to deploy and manage a Flipstarter-based campaign, we recommend you work with a web developer who can manage everything for you.

Corentin Mercier offers a service here.

Development

Run the NodeJS development server

You need NodeJS installed on your machine, then run:

npm install
npm start

# or on windows:
npm run start-no-debug

And open up localhost:3000 in your browser.

Run the Docker container

You need Docker installed on your machine, then run:

docker build -t flipstarter .
docker volume create flipstarter
docker run -v flipstarter:/app/static/campaigns -p 3000:3000 flipstarter

And open up localhost:3000 in your browser.

Environment variables

  ENV FLIPSTARTER_IPFS_GATEWAY_URL="http://..."       //defaults to "https://ipfs.io"
  ENV FLIPSTARTER_IPFS_CREATE_CID="Qm..."             //defaults to QmfZZXZPTLGk3e3h5oGX25qtXf4Nmdqv5RZgUyM44CaDbF"

  ENV FLIPSTARTER_API_URL="https://..."               //defaults to req.get('host')
  
  ENV FLIPSTARTER_API_REDIRECT_HOME_URL="https://..." //defaults to /create

  ENV FLIPSTARTER_API_AUTH="pending-contributions"    //required

  ENV FLIPSTARTER_TARGET_FEE_RATE=1              

FLIPSTARTER_TARGET_FEE_RATE minimum satoshi per byte to attempt assurance contract fullfillment (client is responsible for paying enough per byte) FLIPSTARTER_API_URL refers to the servers public address (returned to user to embed in their client side flipstarter page) FLIPSTARTER_API_REDIRECT_HOME_URL refers to the URL to redirect for root (/) GET requests (set this to redirect to a default campaign) FLIPSTARTER_API_AUTH refers to authentication scheme. Valid values include 'no-auth', 'pending-contributions', 'confirmed-contributions' no-auth: anyone can create a flipstarter pending-contributions: anyone who's contributed to the default campaign (refuses to store contributions if revoked) confirmed-contributions: anyone who's contributed to a fully funded campaign

Contribute

Submit pull requests at https://gitlab.com/flipstarter/backend

Edit front-end

HTML

HTML files are located in /views/.

CSS/images/fonts

These are located in /static/, in their respective folder.

JavaScript (front-end)

To edit the main application script, edit /source.js and run /webpack.sh to process it.

⚠️ Do NOT edit application.js directly ⚠️

Deploy to production

There are multiple ways to do this.

  1. Use Digital Ocean Marketplace
  2. Use a NodeJS image and serve server.js on port 80 or 443. You can also use a process manager like pm2
  3. Deploy the docker container on port 80 or 443 using the following commands:
# download the latest version of flipstarter
docker pull flipstarter/flipstarter

# create a volume to store the database
docker volume create flipstarter

# run the container on ports 443 and 80
docker run -d --restart always --name flipstarter -v flipstarter:/app/static/campaigns -p 443:3000 -p 80:3000 flipstarter/flipstarter

You can start and stop the container with docker [start/stop] flipstarter.

Add a TLS/SSL certificate

If you deployed the app via Digital Ocean Marketplace (method 1), follow the steps:

  1. Point your domain name (or subdomain) to the IP address of the host using an "A" record. See instructions for NameCheap, Cloudflare or GoDaddy.
  2. Then, access your server via SSH and run the following commands:
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --nginx -d yourdomain.com

Make sure to replace yourdomain.com with your own domain or subdomain.
Fill in the information, and select 2 when asked if you want HTTP traffic redirected to HTTPS.

Try reloading your campaign. Your browser should automatically show that the connection to the website is secure.

If you used method 2 or 3:

  1. Install Nginx, Apache or similar software.
  2. Run the Flipstarter Docker container on an available port - for example port 3000 (docker run -d --restart always --name flipstarter -v flipstarter:/app/static/campaigns -p 3000:3000 flipstarter/flipstarter).
  3. Create a reverse proxy to serve port 3000 via Nginx/Apache.
  4. Install certbot and run it according to your OS and web server.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages