{"id":1594,"date":"2023-08-17T16:25:25","date_gmt":"2023-08-17T07:25:25","guid":{"rendered":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/?p=1594"},"modified":"2023-12-18T16:58:26","modified_gmt":"2023-12-18T07:58:26","slug":"post-1594","status":"publish","type":"post","link":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/archives\/1594","title":{"rendered":"Shiny\u3092\u4f7f\u3063\u3066\u307f\u308b"},"content":{"rendered":"<p>Shiny\u306fR\u306e\u30b3\u30fc\u30c9\u3067\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b\u3053\u3068\u3092\u53ef\u80fd\u306b\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<h4>docker\u3092\u6d3b\u7528\u3057\u307e\u3059\u3002<\/h4>\n<pre class=\"code\"># cat compose.yaml\nversion: '3.1'\n\nservices:\n  shiny:\n    image: rocker\/shiny-verse\n    container_name: shiny\n    restart: always\n    ports:\n      - 3838:3838\n docker pull rocker\/shiny-verse\n# docker compose up -d<\/pre>\n<h4>Apache\u306e\u8a2d\u5b9a (http:\/\/kiku3.tsbio.info\/shiny\/ \u306b\u4f4d\u7f6e\u4ed8\u3051)<\/h4>\n<pre class=\"code\"># cat \/etc\/httpd\/conf.d\/shiny.conf\n&lt;location \/shiny&gt;\n        ProxyPass http:\/\/localhost:3838\/\n        ProxyPassReverse http:\/\/localhost:3838\/\n&lt;\/location&gt;\n# systemctl restart httpd<\/pre>\n<h4>\u52d5\u4f5c\u78ba\u8a8d<\/h4>\n<p>http:\/\/kiku3.tsbio.info\/shiny\/01_hello\/ \u3092\u958b\u304f(\u6700\u5f8c\u306e\u30b9\u30e9\u30c3\u30b7\u30e5\u304c\u91cd\u8981)\u3002<br \/>\n<img decoding=\"async\" src=\"\/labo\/suzuki\/wp-content\/uploads\/2023\/08\/230817shiny01.png\" \/><\/p>\n<h3>\u8a2d\u5b9a<\/h3>\n<h4>\u30b3\u30f3\u30c6\u30ca\u306e\u69d8\u5b50\u3092\u63a2\u308b\u3002<\/h4>\n<pre class=\"code\"># docker exec -it shiny bash\n# cat \/etc\/shiny-server\/shiny-server.conf\n# Instruct Shiny Server to run applications as the user \"shiny\"\nrun_as shiny;\n\n# Define a server that listens on port 3838\nserver {\n  listen 3838;\n\n  # Define a location at the base URL\n  location \/ {\n\n    # Host the directory of Shiny Apps stored in this directory\n    site_dir \/srv\/shiny-server;\n\n    # Log all Shiny output to files in this directory\n    log_dir \/var\/log\/shiny-server;\n\n    # When a user visits the base URL rather than a particular application,\n    # an index of the applications available in this directory will be shown.\n    directory_index on;\n  }\n}\n<\/pre>\n<h4>R\u306e\u30b3\u30fc\u30c9\u3092\u7f6e\u304f\u5834\u6240\u3092\u30b3\u30f3\u30c6\u30ca\u306e\u5916\u306b\u3059\u308b\u3002<\/h4>\n<pre class=\"code\"># docker cp shiny:\/srv\/shiny-server shiny\/apps\n# docker compose down\n<\/pre>\n<h4>compose.yaml\u3092\u4fee\u6b63\u3057\u3066\u3001\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u6210\u3057\u306a\u304a\u3059\u3002<\/h4>\n<pre class=\"code\"># cat compose.yaml\nversion: '3.1'\n\nservices:\n  shiny:\n    image: rocker\/shiny-verse\n    container_name: shiny\n    restart: always\n    ports:\n      - 3838:3838\n    volumes:\n      - .\/shiny\/apps:\/srv\/shiny-server\n# docker compose up -d<\/pre>\n<p>shiny\/apps\/01_hello\/app.R\u3092\u5c11\u3057\u3044\u3058\u3063\u3066\u3001\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u304c\u5909\u308f\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3002<\/p>\n<h3>\u30d7\u30ed\u30b0\u30e9\u30e0\u958b\u767a<\/h3>\n<p>01_hello\u3092\u4e38\u3054\u3068pikmin\u306b\u30b3\u30d4\u30fc\u3057\u3066\u3001app.R\u3068Readme.md\u3092\u3044\u3058\u308b\u3002<br \/>\n<a href=\"http:\/\/kiku3.tsbio.info\/shiny\/pikmin\/\">https:\/\/kiku3.tsbio.info\/shiny\/pikmin\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shiny\u306fR\u306e\u30b3\u30fc\u30c9\u3067\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b\u3053\u3068\u3092\u53ef\u80fd\u306b\u3057\u307e\u3059\u3002 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb docker\u3092\u6d3b\u7528\u3057\u307e\u3059\u3002 # cat compose.yaml version: &#8216;3.1&#8217; services: shiny:  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,16,13,7],"tags":[],"_links":{"self":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts\/1594"}],"collection":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/comments?post=1594"}],"version-history":[{"count":24,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts\/1594\/revisions"}],"predecessor-version":[{"id":1944,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/posts\/1594\/revisions\/1944"}],"wp:attachment":[{"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/media?parent=1594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/categories?post=1594"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/biochemistry.isc.chubu.ac.jp\/labo\/suzuki\/wp-json\/wp\/v2\/tags?post=1594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}