diff --git a/README.md b/README.md index f5af9b90..b0248096 100644 --- a/README.md +++ b/README.md @@ -48,18 +48,45 @@ __Note__: since _LMS_ stores hashed and salted passwords, it cannot handle the _ ## Installation -__Note__: this installation process and the default values of the configuration file and the _systemd_ service file have been written for _Debian Buster_. Therefore, you may have to adapt commands and/or paths in order to fit to your distribution. +### From packages -### Build dependencies +#### Debian Buster packages + +_Buster_ packages are provided for _amd64_ and _armhf_ architectures. + +As root, trust the following debian package provider and add it in your list of repositories: +```sh +wget -O - https://debian.poupon.io/apt/debian/epoupon.gpg.key | apt-key add - +echo "deb https://debian.poupon.io/apt/debian buster main" > /etc/apt/sources.list.d/epoupon.list +``` + +To install _LMS_: +```sh +apt-get update +apt-get install lms +``` + +To upgrade _LMS_: +```sh +apt-get update +apt-get install lms +``` + +By default, the _lms_ service is started just after the package installation. You may want to refer to [Deployment](#deployment) for further configuration options. + +### From Sources +__Note__: this installation process and the default values of the configuration files have been written for _Debian Buster_. Therefore, you may have to adapt commands and/or paths in order to fit to your distribution. + +#### Build dependencies __Note__: a C++17 compiler is needed to compile _LMS_ ```sh -apt-get install g++ autoconf automake libboost-filesystem-dev libboost-system-dev libavcodec-dev libavutil-dev libavformat-dev libav-tools libmagick++-dev libpstreams-dev libconfig++-dev libpstreams-dev ffmpeg libtag1-dev +apt-get install g++ autoconf automake libboost-filesystem-dev libboost-system-dev libavutil-dev libavformat-dev libmagick++-dev libpstreams-dev libconfig++-dev libpstreams-dev ffmpeg libtag1-dev ``` You also need _W4_, that is not packaged yet on _Debian_. See [installation instructions](https://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html). -### Build +#### Build Get the latest stable release and build it: ```sh @@ -81,13 +108,7 @@ make ``` __Note__: you can use `make -jN` to speed up compilation time (N is the number of compilation workers to spawn). -#### Raspberry 3 build notes - -Due to memory limitations, you may need to build _Wt4_ in _Release_ mode if you want to compile it natively on a Raspberry Pi3B+. - -The build process is really long, roughly 1 hour to build _Wt4_ + _LMS_. - -### Deployment +#### Installation __Note__: the commands of this section require root privileges. @@ -106,20 +127,40 @@ cp /usr/share/lms/default.conf /etc/lms.conf cp /usr/share/lms/default.service /lib/systemd/system/lms.service ``` -Create working directories and give access to the _lms_ user: +Create the working directory and give it access to the _lms_ user: ```sh mkdir /var/lms -touch /var/log/lms.log -touch /var/log/lms.access.log -chown lms:lms /var/lms /var/log/lms.log /var/log/lms.access.log +chown lms:lms /var/lms ``` +To make _LMS_ run automatically during startup: +```sh +systemctl enable lms +``` + +#### Upgrade + +To upgrade `LMS` from sources, you need to update the master branch and rebuild/install it: +```sh +cd build +git pull +make +``` + +Then using root privileges: +```sh +make install +systemctl restart lms +``` + +## Deployment + __Note__: don't forget to give the _lms_ user read access to the music directory you want to scan. ### Configuration _LMS_ uses a configuration file, installed by default in `/etc/lms.conf`. It is recommended to edit this file and change relevant settings (listen address, listen port, working directory, Subsonic API activation, ...). -All other settings are set using the web interface (user management, scan settings, transcode settings, ...). +All other settings are set using the web interface (user management, scan settings, transcode settings, ...). If a setting is not present in the configuration file, a hardcoded default value is used (the same as in the [default.conf](https://github.com/epoupon/lms/blob/master/conf/default.conf) file) @@ -156,36 +197,14 @@ server { ```sh systemctl start lms ``` -Two log files are used: -* `/var/log/lms.log`: logs of the `lms` daemon -* `/var/log/lms.access.log`: access logs of the embedded web server + +Log traces can be accessed using journactl: +```sh +journalctl -u lms.service +``` To connect to _LMS_, just open your favorite browser and go to http://localhost:5082 -To make _LMS_ run automatically during startup: -```sh -systemctl enable lms -``` - -## Upgrade - -To upgrade `LMS`, you need to update the master branch and rebuild/install it: -```sh -cd build -git pull -make -``` - -Then using root privileges: -```sh -make install -systemctl restart lms -``` - -Read the [release notes](https://github.com/epoupon/lms/releases) to check if any relevant setting has been added into the configuration file. - -Any change in the database schema is made automatically by the application during startup. - ## Credits * Wt (http://www.webtoolkit.eu/) * bootstrap3 (http://getbootstrap.com/) diff --git a/conf/default.conf b/conf/default.conf index aed20433..7c310b0a 100644 --- a/conf/default.conf +++ b/conf/default.conf @@ -3,8 +3,12 @@ # Path to the working directory # Must have write privileges in order to create and modify this directory working-dir = "/var/lms/"; -log-file = "/var/log/lms.log"; -access-log-file = "/var/log/lms.access.log"; + +# Log files, empty means stdout +log-file = ""; +access-log-file = ""; +# Logger configuration, see log-config in https://webtoolkit.eu/wt/doc/reference/html/overview.html#config_general +log-config = "* -debug -info:WebRequest"; # Listen port/addr of the web server listen-port = 5082; @@ -18,7 +22,7 @@ tls-key = "/var/lms/privkey.pem"; tls-dh = "/var/lms/dh2048.pem"; # Path to the resources used by the web interface -wt-resources="/usr/share/Wt/resources"; +wt-resources = "/usr/share/Wt/resources"; docroot = "/usr/share/lms/docroot/;/resources,/css,/images,/js,/favicon.ico"; approot = "/usr/share/lms/approot"; @@ -28,9 +32,6 @@ acousticbrainz-api-url = "https://acousticbrainz.org/api/v1/"; # API api-subsonic = true; -# Logger configuration, see log-config in https://webtoolkit.eu/wt/doc/reference/html/overview.html#config_general -log-config = "* -debug -info:WebRequest"; - # Turn on this option to allow the demo account creation/use demo = false; diff --git a/configure.ac b/configure.ac index 33d7b9e6..7865219f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT(lms, 2.2.0, test@test) +AC_INIT(lms, 3.0.0, test@test) AM_INIT_AUTOMAKE AC_CONFIG_HEADER(src/config/config.h) @@ -29,6 +29,11 @@ AC_CHECK_LIB([pthread], , [AC_MSG_ERROR([libpthread not found!])]) +AC_CHECK_LIB([boost_system], + [main], + , + [AC_MSG_ERROR([libboost_system not found!])]) + AC_CHECK_LIB([wt], [main], , @@ -55,21 +60,11 @@ AC_CHECK_LIB([avutil], , [AC_MSG_ERROR([libavutil not found!])]) -AC_CHECK_LIB([avcodec], - [avcodec_find_decoder], - , - [AC_MSG_ERROR([libavcodec not found!])]) - AC_CHECK_LIB([avformat], [av_read_frame], , [AC_MSG_ERROR([libavformat not found!])]) -AC_CHECK_LIB([boost_system], - [main], - , - [AC_MSG_ERROR([libboost_system not found!])]) - AC_CHECK_LIB( [tag], [main], , diff --git a/src/main/main.cpp b/src/main/main.cpp index 9837683e..ad585439 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -66,7 +66,8 @@ std::vector generateWtConfig(std::string execPath) args.push_back("--http-address=" + getService()->getString("listen-addr", "0.0.0.0")); } - args.push_back("--accesslog=" + wtAccessLogFilePath.string()); + if (!wtAccessLogFilePath.empty()) + args.push_back("--accesslog=" + wtAccessLogFilePath.string()); // Generate the wt_config.xml file boost::property_tree::ptree pt; diff --git a/src/ui/explore/Explore.cpp b/src/ui/explore/Explore.cpp index d44129da..659aac58 100644 --- a/src/ui/explore/Explore.cpp +++ b/src/ui/explore/Explore.cpp @@ -179,7 +179,7 @@ Explore::Explore() static std::vector -getArtistsTracks(Database::Session& session, const std::vector& artistsId, const std::set& clusters) +getArtistsTracks(Database::Session& session, const std::vector& artistsId, const std::set&) { std::vector res; diff --git a/test/Makefile.am b/test/Makefile.am index 1b43e04a..15efaba5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,17 +1,17 @@ -TESTS = som database +TESTS = test-som test-database -check_PROGRAMS = som database +check_PROGRAMS = test-som test-database -som_SOURCES = \ +test_som_SOURCES = \ $(srcdir)/som/SomTest.cpp \ $(top_srcdir)/src/similarity/features/som/DataNormalizer.cpp \ $(top_srcdir)/src/similarity/features/som/Network.cpp -som_CXXFLAGS=-std=c++17 -I${top_srcdir}/src/ -I${top_srcdir}/src/similarity/features/som/ +test_som_CXXFLAGS=-std=c++17 -I${top_srcdir}/src/ -I${top_srcdir}/src/similarity/features/som/ -database_SOURCES = \ +test_database_SOURCES = \ $(srcdir)/database/DatabaseTest.cpp \ $(top_srcdir)/src/database/Artist.cpp \ $(top_srcdir)/src/database/Cluster.cpp \ @@ -29,5 +29,5 @@ database_SOURCES = \ $(top_srcdir)/src/utils/Logger.cpp \ $(top_srcdir)/src/utils/Utils.cpp -database_CXXFLAGS=-std=c++17 -I${top_srcdir}/src/ +test_database_CXXFLAGS=-std=c++17 -I${top_srcdir}/src/