ユーザ用ツール

サイト用ツール


linux:shiny_server

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
linux:shiny_server [2020/11/24 13:21] – 作成 Wiki Editorlinux:shiny_server [2020/11/24 13:22] (現在) – 作成 Wiki Editor
行 1: 行 1:
-====== LimeSurvey関係 ======+====== Shiny Server ======
  
-オープンソースのWebアンケートサーバ「LimeSurvey」のインストール時のポイント。+  * [[https://github.com/rstudio/shiny-server/wiki/Building-Shiny-Server-from-Source]] 
 +  * [[https://rstudio.github.io/shiny-server/os/latest/#configuration-settings]]
  
-MySQLージョンを8系にしてInnodbを利用しようとすンストールスクリ要件チェックではじかれる。これらのチェックを効化してやり過ごす。+ RでWebアプリケーションを開発するためパッケージShinyをWebアプリケーションして動作させためのサーバ。オンプレミスの有償版は金額が高くホスティグサービは無償アカウンもあるがデータを外部のサーバに置くのは問題が多いため、オープンソース版を使う。いくつかOSではパッケージが用意さていが、Gentoo向けにはいのでソースからビルド
  
-application/models/InstallerConfigForm.php+===== 事前準備 ===== 
 +Pythonと親和性が高いGentooでは特に事前にインストールするものはない。R自体はインストールする必要がある。
  
-    public function validateDBEngine($attribute) 
-    { 
-        if ($this->isMysql 
-            && ($this->dbengine === null or !in_array($this->dbengine, array_keys($this->dbEngines)))) { 
-            $this->addError($attribute, gT('The database engine type must be set for MySQL')); 
-        } 
-         
-        #if ($this->isMysql && $this->dbengine === self::ENGINE_TYPE_INNODB) { 
-        #    if (!$this->isInnoDbLargeFilePrefixEnabled()) { 
-        #        $this->addError($attribute, gT('You need to enable large_file_prefix setting in your database configuration in o\rder to use InnoDB engine for LimeSurvey!')); 
-        #    } 
-        #    if (!$this->isInnoDbBarracudaFileFormat()) { 
-        #        $this->addError($attribute, gT('Your database configuration needs to have innodb_file_format and innodb_file_for\mat_max set to use the Barracuda format in order to use InnoDB engine for LimeSurvey!')); 
-        #    } 
-        #} 
-    } 
  
-以前のバージョンで設定しなければならなオプションはMySQL8では廃止されるた値がセットされていないような状況になってインストールが進められない。チェックしているロジックをすべてコメントアウトして対応+===== ビルドとインストール ===== 
 + 基本的にマニュアル通り。以前は1ステップ必要手順が抜いて、コミュニティの書き込みを参照す必要があっ修正されていよう
  
-もう一つの躓きポイントは単なるバグ。ネットワーク経由でDBに接続するのではなく、ソケッを利用する場合DSN構築にミスがありうまく接続できない。+  > git clone https://github.com/rstudio/shiny-server.git 
 +  > cd shiny-server 
 +  > mkdir tmp 
 +  > cd tmp 
 +  > ../external/node/install-node.sh 
 +   
 +  # 環境変数をセット 
 +  > DIR=`pwd` 
 +  > PATH=$DIR/../bin:$PATH 
 +  >  cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../ 
 +   
 +  > make 
 +  > mkdir ../build 
 +  > (cd .. && ./bin/npm install) 
 +  > (cd .. && ./bin/node ./ext/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild) 
 +  > make install 
 +   
 +  # 設定ファイルを配置するディレク作成 
 +  > mkdir /etc/shiny-server  
 +  > cp ../config/default.config /etc/shiny-server/shiny-server.conf
  
-    private function getMysqlDsn() { +shinyユーザを作成し、各種ディレクトリ等を作成する。 
-     + 
-        $port = $this->getDbPort(); +今回は、/home/shinyをホームディレクトリとしたshinyユーザを作成し、各種ディレクトリもここに集約する。shinyユーザにはシェルを与えずログインできないようにしておく。 
-         + 
-        // MySQL allow unix_socket for database location, then test if $sDatabaseLocation start with "/" +  * ${shiny_home}/log  
-        if (substr($this->dblocation, 0, 1) == "/") { +  ${shiny_home}/server 
-            $sDSN = "mysql:unix_socket={$this->dblocation};"; +  ${shiny_home}/lib 
-        else { +  * ${shiny_home}/bookmarks 
-            $sDSN "mysql:host={$this->dblocation};port={$port};"; + 
-        } +===== 設定 ===== 
-         +/etc/shiny-server/shiny-server.confを上記ディレクトリ構成にあわせて設定する。 
-        if ($this->useDbName) + 
-            $sDSN .= "dbname={$this->dbname};"+マニュアルにはないが、bookmarksディレクトリを書き込み可能な形で設定しておかないと、サーバが起動しない。 
-        } + 
-        return $sDSN;+  # Instruct Shiny Server to run applications as the user "shiny"                                                     
 +  run_as shiny
 +   
 +  # Define a server that listens on port 3838                                                                         
 +  server 
 +    listen 3838 0.0.0.0; 
 +   
 +    # Define a location at the base URL                                                                               
 +    location / { 
 +   
 +      # Host the directory of Shiny Apps stored in this directory                                                     
 +      site_dir /home/shiny/server; 
 +   
 +      # Log all Shiny output to files in this directory                                                               
 +      log_dir /home/shiny/log
 +   
 +      # Bookmark dir                                                                                                  
 +      bookmark_state_dir /home/shiny/bookmarks; 
 +   
 +      # When a user visits the base URL rather than a particular application,                                         
 +      # an index of the applications available in this directory will be shown.                                       
 +      directory_index on;
     }     }
 +  }
 +
 +===== 起動スクリプト =====
 +Gentoo OpenRC用の起動スクリプト。
 +
 +注意点は、start-stop-daemonのオプション「--background」「--make-pidfile」をつけておくこと。
 +
 +shinyは勝手にバックグラウンドにならないのでbackgroundオプションで切り離し、 pidファイルも生成しないのでmake-pidfileでpidfileオプションで指定した場所にpidファイルを吐き出させる。これでstop関数が正常に動作する。
 +
 +
  
-上記の関数の「$sDSN = "mysql:unix_socket={$this->dblocation}";」を「$sDSN = "mysql:unix_socket={$this->dblocation}__;__";」にする。「;」が1つ抜けているため、そのままDSNを構築するとソケットファイル名に続くパラメータが区切り文字なしに結合されてしまい、DBに接続できなくなる。バグ報告は暇を見つけてやっておきたい。+  #!/sbin/openrc-run 
 +  # Copyright 1999-2016 Gentoo Foundation 
 +  # Distributed under the terms of the GNU General Public License v2 
 +   
 +  description="R Shiny Server" 
 +  pidfile="/var/run/shiny-server.pid" 
 +  command="/usr/local/shiny-server/bin/shiny-server" 
 +   
 +  depend() { 
 +          use net 
 +  } 
 +   
 +  start() { 
 +          ebegin "Starting Shiny Server" 
 +          start-stop-daemon --start --quiet --background --make-pidfile --pidfile ${pidfile} --exec ${command} \ 
 +          >> /home/shiny/log/shiny-server.log 2>&
 +          eend $? 
 +  } 
 +   
 +  stop() { 
 +          ebegin "Stopping Shiny Server" 
 +          start-stop-daemon --stop --quiet --pidfile ${pidfile} 
 +          eend $? 
 +  }
  
  
linux/shiny_server.1606191673.txt.bz2 · 最終更新: 2020/11/24 13:21 by Wiki Editor

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki