mirror of
https://github.com/cgzirim/seek-tune.git
synced 2025-12-18 17:34:22 +00:00
commit
649f19b4a0
35 changed files with 123 additions and 8 deletions
28
.dockerignore
Normal file
28
.dockerignore
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.ogg
|
||||||
|
*.m4a
|
||||||
|
*.zip
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
**/songs
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
package-lock.json
|
||||||
|
|
||||||
|
*sqlite3
|
||||||
|
.env
|
||||||
7
.env.example
Normal file
7
.env.example
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
DB_TYPE=mongo
|
||||||
|
DB_USER=user
|
||||||
|
DB_PASS=password
|
||||||
|
DB_NAME=seek-tune
|
||||||
|
DB_HOST=192.168.0.1
|
||||||
|
DB_PORT=27017
|
||||||
|
REACT_APP_BACKEND_URL=http://localhost:5000
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -26,3 +26,5 @@ go.work
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
*sqlite3
|
||||||
|
.env
|
||||||
33
Dockerfile
Normal file
33
Dockerfile
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
# build react
|
||||||
|
FROM node:20-alpine AS build_react_stage
|
||||||
|
|
||||||
|
RUN mkdir -p /home/react
|
||||||
|
WORKDIR /home/react
|
||||||
|
|
||||||
|
COPY client/package.json ./
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY client/ ./
|
||||||
|
ARG REACT_APP_BACKEND_URL
|
||||||
|
ENV REACT_APP_BACKEND_URL=${REACT_APP_BACKEND_URL}
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# build go
|
||||||
|
FROM golang:1.21.6
|
||||||
|
|
||||||
|
WORKDIR /home/seek-tune
|
||||||
|
|
||||||
|
COPY server/go.mod server/go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY server/ ./
|
||||||
|
ENV ENV=production
|
||||||
|
|
||||||
|
RUN mkdir -p static
|
||||||
|
COPY --from=build_react_stage /home/react/build static
|
||||||
|
|
||||||
|
RUN go build -o seek-tune
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD [ "/home/seek-tune/seek-tune", "serve" ]
|
||||||
23
README.md
23
README.md
|
|
@ -25,22 +25,35 @@ Additionally, it currently only supports song files in WAV format.
|
||||||
- NPM: To run the client (frontend).
|
- NPM: To run the client (frontend).
|
||||||
|
|
||||||
### Steps
|
### Steps
|
||||||
Clone the repository:
|
📦 Clone the repository:
|
||||||
```
|
```
|
||||||
git clone https://github.com/cgzirim/seek-tune.git
|
git clone https://github.com/cgzirim/seek-tune.git
|
||||||
|
cd seek-tune
|
||||||
```
|
```
|
||||||
|
#### 🐳 Set Up with Docker
|
||||||
|
Prerequisites: [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)
|
||||||
|
1. Build and run the application:
|
||||||
|
```Bash
|
||||||
|
docker-compose up --build
|
||||||
|
```
|
||||||
|
Visit the app at http://localhost:8080
|
||||||
|
2. To stop the application:
|
||||||
|
```Bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
#### 💻 Set Up Natively
|
||||||
Install dependencies for the backend
|
Install dependencies for the backend
|
||||||
```
|
```
|
||||||
cd seek-tune
|
cd server
|
||||||
go get ./...
|
go get ./...
|
||||||
```
|
```
|
||||||
Install dependencies for the client
|
Install dependencies for the client
|
||||||
```
|
```
|
||||||
cd seek-tune/client
|
cd client
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage :bicyclist:
|
## Usage (Native Setup) :bicyclist:
|
||||||
|
|
||||||
#### ▸ Start the Client App 🏃♀️➡️
|
#### ▸ Start the Client App 🏃♀️➡️
|
||||||
```
|
```
|
||||||
|
|
@ -51,7 +64,7 @@ npm start
|
||||||
#### ▸ Start the Backend App 🏃♀️
|
#### ▸ Start the Backend App 🏃♀️
|
||||||
In a separate terminal window:
|
In a separate terminal window:
|
||||||
```
|
```
|
||||||
cd seek-tune
|
cd server
|
||||||
go run *.go serve [-proto <http|https> (default: http)] [-port <port number> (default: 5000)]
|
go run *.go serve [-proto <http|https> (default: http)] [-port <port number> (default: 5000)]
|
||||||
```
|
```
|
||||||
#### ▸ Download a Song 📥
|
#### ▸ Download a Song 📥
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
version: 0.0
|
version: 0.0
|
||||||
os: linux
|
os: linux
|
||||||
files:
|
files:
|
||||||
- source: /
|
- source: server/
|
||||||
destination: /home/ubuntu/song-recognition
|
destination: /home/ubuntu/song-recognition
|
||||||
hooks:
|
hooks:
|
||||||
BeforeInstall:
|
BeforeInstall:
|
||||||
|
|
|
||||||
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
version: '3.1'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
seek-tune-db:
|
||||||
|
seek-tune-songs:
|
||||||
|
|
||||||
|
services:
|
||||||
|
seek-tune:
|
||||||
|
image: 'seek-tune'
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 8080:5000
|
||||||
|
|
||||||
|
environment:
|
||||||
|
DB_TYPE: ${DB_TYPE:-sqlite}
|
||||||
|
DB_USER: ${DB_USER:-root}
|
||||||
|
DB_PASSWORD: ${DB_PASSWORD:-password}
|
||||||
|
DB_NAME: ${DB_NAME:-seek_tune_db}
|
||||||
|
DB_HOST: ${DB_HOST:-localhost}
|
||||||
|
DB_PORT: ${DB_PORT:-27017}
|
||||||
|
|
||||||
|
REACT_APP_BACKEND_URL: ${REACT_APP_BACKEND_URL:-http://localhost:8080}
|
||||||
|
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
REACT_APP_BACKEND_URL: ${REACT_APP_BACKEND_URL:-http://localhost:8080}
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- seek-tune-db:/home/seek-tune/db
|
||||||
|
- seek-tune-songs:/home/seek-tune/songs
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
start_server() {
|
start_server() {
|
||||||
cd /home/ubuntu/song-recognition
|
cd /home/ubuntu/song-recognition/server
|
||||||
|
|
||||||
export SERVE_HTTPS="true"
|
export SERVE_HTTPS="true"
|
||||||
export CERT_KEY="/etc/letsencrypt/live/localport.online/privkey.pem"
|
export CERT_KEY="/etc/letsencrypt/live/localport.online/privkey.pem"
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@ func serve(protocol, port string) {
|
||||||
|
|
||||||
func serveHTTP(socketServer *socketio.Server, serveHTTPS bool, port string) {
|
func serveHTTP(socketServer *socketio.Server, serveHTTPS bool, port string) {
|
||||||
http.Handle("/socket.io/", socketServer)
|
http.Handle("/socket.io/", socketServer)
|
||||||
|
http.Handle("/", http.FileServer(http.Dir("static")))
|
||||||
|
|
||||||
if serveHTTPS {
|
if serveHTTPS {
|
||||||
httpsAddr := ":" + port
|
httpsAddr := ":" + port
|
||||||
|
|
@ -46,7 +46,7 @@ func NewDBClient() (DBClient, error) {
|
||||||
return NewMongoClient(dbUri)
|
return NewMongoClient(dbUri)
|
||||||
|
|
||||||
case "sqlite":
|
case "sqlite":
|
||||||
return NewSQLiteClient("db.sqlite3")
|
return NewSQLiteClient("db/db.sqlite3")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported database type: %s", DBtype)
|
return nil, fmt.Errorf("unsupported database type: %s", DBtype)
|
||||||
BIN
server/songs/Chiquitita.wav
Normal file
BIN
server/songs/Chiquitita.wav
Normal file
Binary file not shown.
BIN
server/songs/Dancing Queen.wav
Normal file
BIN
server/songs/Dancing Queen.wav
Normal file
Binary file not shown.
BIN
server/songs/Jolene.wav
Normal file
BIN
server/songs/Jolene.wav
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue