{"id":17030328,"url":"https://github.com/vsoch/singularity-shiny","last_synced_at":"2025-04-12T12:12:03.609Z","repository":{"id":141668014,"uuid":"128481898","full_name":"vsoch/singularity-shiny","owner":"vsoch","description":"a quick shiny server in a Singularity Container. For @griznog!","archived":false,"fork":false,"pushed_at":"2018-11-06T12:58:55.000Z","size":208,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T12:12:01.458Z","etag":null,"topics":["containers","r","shiny","shiny-server","singularity"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsoch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-07T00:04:48.000Z","updated_at":"2023-07-31T20:26:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"56372324-e087-48bc-a2d1-2b91c847ca50","html_url":"https://github.com/vsoch/singularity-shiny","commit_stats":{"total_commits":8,"total_committers":3,"mean_commits":"2.6666666666666665","dds":0.375,"last_synced_commit":"b782dbcf79974048f873883c31e7733924e36538"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fsingularity-shiny","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fsingularity-shiny/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fsingularity-shiny/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsoch%2Fsingularity-shiny/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsoch","download_url":"https://codeload.github.com/vsoch/singularity-shiny/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248565077,"owners_count":21125417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containers","r","shiny","shiny-server","singularity"],"created_at":"2024-10-14T08:06:17.053Z","updated_at":"2025-04-12T12:12:03.599Z","avatar_url":"https://github.com/vsoch.png","language":"Shell","readme":"# Singularity Shiny\nSingularity Image to run a local shiny server.\n\n## Build\nUse the makefile\n\n```\nmake\n```\n\nor build on your own:\n\n```\nsudo singularity build shiny.simg Singularity\n```\n\n## Generate Configuration\nYou will first generate a custom configuration for your user, and it will\ngive you instructions for usage:\n\n```\n$ /bin/bash prepare_template.sh\n\nSteps:\n          ----------------------------------------------------------------------\n          1. Use this script to prepare your shiny-server.conf (configuration)\n \n               /bin/bash prepare_template.sh\n\n          ----------------------------------------------------------------------\n          2. If needed, you can provide the following arguments\n\n          Commands:\n             help: show help and exit\n             start: the generation of your config\n\n          Options:  \n           --port:  the port for the application (e.g., shiny default is 3737)\n           --user:  the user for the run_as directive in the shiny configuration\n           --base: base folder with applications\n           --logs: temporary folder with write for logs (not required)\n           --disable-index: disable directory indexing\n\n          ----------------------------------------------------------------------\n          3. Make sure Singularity is loaded, and run the container using \n             the commands shown by the template.\n\n```\nWhen you add `start` it will do the generation. Here we don't supply any arguments\nso that they are randomly generated.\n\n```\n$ /bin/bash prepare_template.sh start\nGenerating shiny configuration...\nport: 9870\nlogs: /tmp/shiny-server.gG1X2Z\nbase: /srv/shiny-server\nServer logging will be in /tmp/shiny-server.gG1X2Z\n\nTo run your server:\n\n    module load singularity/2.4.6\n    singularity run --bind /tmp/shiny-server.gG1X2Z/logs:/var/log/shiny \\\n    --bind /tmp/shiny-server.gG1X2Z/lib:/var/lib/shiny-server \\\n    --bind shiny-server.conf:/etc/shiny-server/shiny-server.conf shiny.simg\n\n    ---------------------------------------------------------------------------\n    For custom applications, also add --bind /srv/shiny-server:/srv/shiny-server\n    To see your applications, open your browser to http://127.0.0.1:9870 or\n    open a ssh connection from your computer to your cluster.\n\n```\n\nThe configuration is generated in your present working directory:\n\n```\n$ cat shiny-server.conf\nrun_as vanessa;\nserver {\n  listen 9098;\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 /tmp/shiny-server.PtVRXE;\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```\n\n## Start Server\nOnce you have that template, follow the instructions to run the container. The\ntemporary folder is already created for you.\n\n```\n    singularity run --bind /tmp/shiny-server.gG1X2Z/logs:/var/log/shiny \\\n    --bind /tmp/shiny-server.gG1X2Z/lib:/var/lib/shiny-server \\\n    --bind shiny-server.conf:/etc/shiny-server/shiny-server.conf shiny.simg\n[2018-04-07T00:14:17.403] [INFO] shiny-server - Shiny Server v1.5.7.890 (Node.js v8.10.0)\n[2018-04-07T00:14:17.405] [INFO] shiny-server - Using config file \"/etc/shiny-server/shiny-server.conf\"\n[2018-04-07T00:14:17.456] [INFO] shiny-server - Starting listener on 0.0.0.0:9870\n```\n\n## Interface\nWhen you open your browser to the port instructed, you will see the root of shiny!\n\n![img/shiny-base.png](img/shiny-base.png)\n\nYou can check out the sample apps:\n\n![img/sample-app.png](img/sample-app.png)\n\nYou can press Control+C to exit the server and stop the container. Be careful with running\nShiny with Singularity - if you lose connection to the container and the server is\nrunning, it will remain as a ghost process. When Singularity has the ability for\nthe start script to take arguments, we will be able to run it as an instance\n(but not yet).\n\n## Customization\nIf you shell inside and look under /srv/shiny-server, you will see all the default\n(sample) apps!\n\n```\nsingularity shell shiny.simg\n$ ls /src/shiny-server\nls /srv/shiny-server/\n01_hello  03_reactivity  05_sliders  07_widgets  09_upload    11_timer\t  sample-apps\n02_text   04_mpg\t 06_tabsets  08_html\t 10_download  index.html\n```\nThis means that when you run the container, if you add a bind to a folder of your own apps\nhere, you can add your custom applications. The bind would look something like:\n\n```\n--bind /path/to/apps/folder:/srv/shiny-server\n```\n\nYou can also choose to disable the indexing, meaning that someone that navigates to\nthe root of the server (at the port) won't be able to explore all of your apps.\n\n```\n$ /bin/bash prepare_template.sh --disable-index\n```\n\nYou can also customize the port, temporary folder, \"run_as\" user, and base (if somewhere other than\n/srv/shiny-server). Have fun!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fsingularity-shiny","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsoch%2Fsingularity-shiny","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsoch%2Fsingularity-shiny/lists"}