Skip to content

kevinsqi/pianohub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

622 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PianoHub

See this guide on how /client and /server are set up with Heroku.

Development

  • Install Docker.
  • Create .env file with contents in 1Password file.
  • Create client/.env.local file with the contents:
REACT_APP_HOSTNAME=http://localhost:3000
# Optional, to use local server for soundfont files (e.g. when developing with no internet connection)
REACT_APP_SOUNDFONT_HOSTNAME=http://localhost:3000/soundfonts

To run server at localhost:3001:

  • Run docker-compose build (to re-build the container, run docker-compose build --no-cache)
  • Run docker-compose up

To run the client at localhost:3000:

  • cd client
  • yarn install
  • yarn start

Go to localhost:3000 to view the app.

SSH setup

Deploying

  • In this repo, add dokku remote: git remote add dokku dokku@pianohub.io:pianohub
  • Deploy with git push dokku master

The production server runs on localhost:5000, and port 5000 is necessary as the default exposed port for Dokku nginx.

Interactive shells

Connecting to database

In development:

docker exec -it pianohub_postgres_1 psql postgres://pianohub_user:pianohub@localhost:5432/pianohub

In production, SSH into droplet and do:

dokku postgres:connect pianohub

Migrations and seed data

Creating migrations

cd server
yarn run db:migrate-make add_column_to_table

Running migrations and seed data

In development, re-run docker-compose build and docker-compose up, which will re-run migrations.

In production, SSH into droplet and do:

dokku run pianohub yarn run db:setup

Setting up production deployment

First, set up Dokku on DigitalOcean

DigitalOcean configuration

Set up A records for www and @ which direct to the pianohub.io app.

Dokku configuration

SSH into droplet with ssh root@pianohub.io

Postgres DB setup:

  • Add Postgres add-on by running dokku plugin:install https://github.com/dokku/dokku-postgres.git
  • Run dokku postgres:create pianohub
  • Set up DATABASE_URL env var by running dokku postgres:link pianohub pianohub

Domain configuration:

  • Add domains with dokku domains:add pianohub pianohub.io www.pianohub.io
  • Use dokku-redirect to redirect from pianohub.io to www.pianohub.io: dokku redirect:set pianohub pianohub.io www.pianohub.io

Setting up https with dokku-letsencrypt and this guide:

  • dokku config:set --no-restart pianohub DOKKU_LETSENCRYPT_EMAIL=<email>
  • dokku letsencrypt pianohub
  • dokku letsencrypt:cron-job --add
  • Verify cron job with crontab -l -u dokku

Set environment variables (specified in server/.env.template):

  • dokku config:set pianohub SESSION_KEY=<key> SMTP_HOST=<host> SMTP_PORT=<port> SMTP_AUTH_USERNAME=<username> SMTP_AUTH_PASSWORD=<password>

Email

In development, check emails at https://ethereal.email/messages using SMTP_AUTH_USERNAME and SMPT_AUTH_PASSWORD set in .env.

About

PianoHub lets you create and share music in your browser.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors