From f121c5f4395b603e74c9184c3e01e896a7ed937e Mon Sep 17 00:00:00 2001 From: emeric Date: Mon, 2 May 2016 23:24:19 +0200 Subject: [PATCH] [LOG] Added lms.conf install --- Makefile.am | 3 +++ README.md | 25 +++++++++++++++---------- conf/{lms.conf.sample => lms.conf} | 2 ++ src/main/main.cpp | 1 + 4 files changed, 21 insertions(+), 10 deletions(-) rename conf/{lms.conf.sample => lms.conf} (89%) diff --git a/Makefile.am b/Makefile.am index 28cd688e..a82a941d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,9 @@ lms_images_DATA = \ lms_approot_DATA = \ approot/templates.xml +sysconf_DATA = \ + $(top_srcdir)/conf/lms.conf + install-data-hook: ln -s $(datadir)/Wt/resources $(lms_docrootdir)/resources || echo "Skipped symlink creation" diff --git a/README.md b/README.md index 8cadbd8e..13774a2c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ LMS is written entirely in C++. Therefore, it is suitable to run on embedded dev Please note some media files may require significant CPU usage to be transcoded. ## Dependencies -### Debian or Ubuntu packages +### Debian ```sh $ apt-get install g++ autoconf automake libboost-dev libboost-locale-dev libboost-iostreams-dev libavcodec-dev libwtdbosqlite-dev libwthttp-dev libwtdbo-dev libwt-dev libmagick++-dev libavcodec-dev libavformat-dev libav-tools libpstreams-dev libcurl-dev libcurlpp-dev libconfig++-dev @@ -32,7 +32,7 @@ $ apt-get install g++ autoconf automake libboost-dev libboost-locale-dev libboos $ autoreconf -vfi $ mkdir build $ cd build -$ ../configure --prefix=/usr +$ ../configure --prefix=/usr --sysconfdir=/etc ``` configure will complain if a mandatory library is missing. @@ -47,19 +47,27 @@ $ make install ``` This command requires root privileges +## Configuration +LMS uses a config file for low level settings: +- database file path, default is /var/lms/lms.db +- TLS settings, default is none +- listen address/port, default is 0.0.0.0 port 5081 + +Other settings are set using the web interface. +By default, LMS will read its configuration in the file '/etc/lms.conf' + ## Running -Here is a command line example to run on port 5081: ```sh -$ /usr/bin/lms --docroot='/usr/share/lms/docroot/;/resources,/css,/images,/favicon.ico' --approot=/usr/share/lms/approot --http-address 0.0.0.0 --http-port 5081 +$ /usr/bin/lms [/path/to/config/file] ``` +LMS needs write access to the directory used for the database. It is highly recommended to run LMS as a non root user. -The exectuable needs write accesses to the /var/lms/ directory. To connect to LMS, just open your favorite browser and go to http://localhost:5081 ## Mobile -Add the following code in your wt_config.xml file: +Add the following code in your /etc/wt/wt_config.xml file: ``` true @@ -77,10 +85,6 @@ Generate a self signed certificate: ```sh $ openssl req -x509 -out cert.pem -keyout privkey.pem -newkey rsa:4096 ``` -Run (on port 5081): -```sh -$ /usr/bin/lms --docroot='/usr/share/lms/docroot/;/resources,/css,/images,/favicon.ico' --approot=/usr/share/lms/approot --https-address 0.0.0.0 --https-port 5081 --ssl-certificate cert.pem --ssl-private-key privkey.pem --ssl-tmp-dh dh2048.pem -``` Depending on your SSL parameters, you may be asked for the PEM passphrase to unlock the private key. To connect to LMS, just open your favorite browser and go to https://localhost:5081 @@ -91,3 +95,4 @@ To connect to LMS, just open your favorite browser and go to https://localhost:5 - bootstrap3 (http://getbootstrap.com/) - libav project (https://www.libav.org/) - Magick++ (http://www.imagemagick.org/Magick++/) +- MetaBrainz (https://metabrainz.org/) diff --git a/conf/lms.conf.sample b/conf/lms.conf similarity index 89% rename from conf/lms.conf.sample rename to conf/lms.conf index ac7267b1..79adc916 100644 --- a/conf/lms.conf.sample +++ b/conf/lms.conf @@ -20,3 +20,5 @@ tls-dh = "/var/lms/dh2048.pem"; docroot = "/usr/share/lms/docroot/;/resources,/css,/images,/favicon.ico"; approot = "/usr/share/lms/approot"; +# Path to the wt_config.xml file +wt-config = "/etc/wt/wt_config.xml"; diff --git a/src/main/main.cpp b/src/main/main.cpp index 18f9cd80..67671166 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -38,6 +38,7 @@ static std::vector getWtArgs(std::string path) std::vector args; args.push_back(path); + args.push_back("-c" + Config::instance().getString("wt-config")); args.push_back("--docroot=" + Config::instance().getString("docroot")); args.push_back("--approot=" + Config::instance().getString("approot"));