Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions MyMusicBoxApi/release
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ COOKIES_FOLDER="$RELEASE_FOLDER/selenium"
MIGRATION_FOLDER="$RELEASE_FOLDER/migration_scripts"

echo "=== Setting up release folder ==="

FOLDERS=(
"$RELEASE_FOLDER"
"$DATABASE_FOLDER"
Expand All @@ -38,7 +37,11 @@ cp selenium/* "$COOKIES_FOLDER"
cp migration_scripts/* "$MIGRATION_FOLDER"

echo "=== Building executable ==="
go build -buildvcs=false -o "$RELEASE_FOLDER"
go build -trimpath -buildvcs=false -ldflags="-s -w" -o "$RELEASE_FOLDER"

echo "=== Reducing executable size ==="
cd "$RELEASE_FOLDER"
upx --best --lzma musicboxapi

echo "=== Starting Docker containers ==="
cd "$DATABASE_FOLDER"
Expand Down
12 changes: 12 additions & 0 deletions MyMusicBoxApi/reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# stop dev docker postgres
cd ..
cd dev_database
sudo docker compose down

# delete dev db files
sudo rm -r data/

# restart dev docker
sudo docker compose up -d
29 changes: 28 additions & 1 deletion MyMusicBoxApi/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
#!/bin/bash
./stop
echo "=== Setting up folders ==="
IMAGES_FOLDER="music_dev/images"

FOLDERS=(
"$IMAGES_FOLDER"
)

for folder in "${FOLDERS[@]}"; do
if [ ! -d "$folder" ]; then
mkdir -p "$folder"
echo "Created: $folder"

if [[ "music_dev/images" == $folder ]]; then
echo "Copied default image"
cp default/images/* "$IMAGES_FOLDER"
fi
else
echo "Exists: $folder"
fi
done

# start dev database
cd ..
cd dev_database
sudo docker compose up -d

# run executable
cd ..
cd MyMusicBoxApi
sudo go run main.go -port=8081 -devurl -sourceFolder="music_dev" -outputExtension="opus" &

echo $! > go_program.pid
7 changes: 6 additions & 1 deletion MyMusicBoxApi/stop
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ if [ -f go_program.pid ]; then
PID=$(cat go_program.pid)
echo "Killing process with PID $PID"
sudo kill "$PID"
rm go_program.pid
rm -f go_program.pid
else
echo "PID file not found. Process might not be running or already terminated."
fi

# kill dev database
cd ..
cd dev_database
sudo docker compose down
6 changes: 5 additions & 1 deletion MyMusicBoxApi/update
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ cp default/* "$IMAGES_FOLDER"
cp selenium/* "$COOKIES_FOLDER"

echo "=== Updating executable ==="
go build -buildvcs=false -o "$RELEASE_FOLDER"
go build -trimpath -buildvcs=false -ldflags="-s -w" -o "$RELEASE_FOLDER"

echo "=== Reducing executable size ==="
cd "$RELEASE_FOLDER"
upx --best --lzma musicboxapi

echo "=== Restarting mymusic service ==="
sudo systemctl stop mymusic || echo "Service 'mymusic' was not running."
Expand Down
2 changes: 1 addition & 1 deletion dev_database/initscripts/init_script.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ CREATE INDEX idx_playlistsong_song ON PlaylistSong(SongId);
-- Main playlist for all songs
-- Should not show up in playlist list, instead under tab all songs
INSERT INTO Playlist (Name, Description, ThumbnailPath, IsPublic) VALUES
('Library', 'Default playlist for all', 'default_playlist_cover.png', FALSE);
('Library', 'Default playlist for all', 'default_playlist_cover.jpg', FALSE);

-- =============================================
-- SECTION 7: SAMPLE DATA
Expand Down