Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.11 KB

README.md

File metadata and controls

53 lines (38 loc) · 2.11 KB

Dotify

"Mobile first" full stack web app for streaming music.

Setting up a local dev server

Clone this repository and set up a MySQL Server if you do not already have one.

Database

  1. Navigate to /backend/models/sql/

  2. Log in to the Database

  3. Create a new database and user with privileges on that database

  4. Run use <YOUR DATABASE NAME>

  5. Run source create-tables.sql

  6. Insert a row to the table user by running the following SQL statement

    INSERT INTO
    user (username, password, superuser)
    VALUES("<YOUR USERNAME>", "<YOUR BCRYPT HASHED PASSWORD>", 1)
    

You will have to hash the password yourself using any bcrypt hashing tool. This row will act as your admin account, you may create multiple if you want more than one admin. There is currently no use for non-admin users.

Backend

  1. Navigate to /backend/
  2. Run the backend server with DBUSER="<YOUR DATABASE USER>" DBPASS="<YOUR DATABASE PASSWORD>" DBNAME="<YOUR DATABASE'S NAME>" BACKEND_PORT=3000 UPLOADS_DIR_PREFIX="../frontend/public/" go run .

Frontend

  1. Navigate to /frontend/
  2. Run npm install and wait for it to complete.
  3. Run npm run dev to start the vite dev server.
  4. Open your browser and navigate to localhost:5173

Build for production

  1. Set up the Database like in the section above.
  2. Set up the frontend like above by running npm install inside /frontend/
  3. In the frontend directory, run npx vite build.
    • This builds a production ready build in /frontend/dist/, which you simply put inside /var/www/html/ (or another directory used by your web server)
  4. Build the backend binary with GOARCH="amd64" GOOS="linux" go build -o backend
    • (you may replace the variables above with whatever is relevant to your server)
    • Put this binary on your server somewhere, and create a systemd service or screen/tmux session for it.
    • You must specify a different UPLOADS_DIR_PREFIX relevant to your deployment.
      • It should point to wherever you put the frontend dist files