add filebrowser
							parent
							
								
									1b83ae6f92
								
							
						
					
					
						commit
						c6f9c77822
					
				@ -0,0 +1,147 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
			
		||||
<svg
 | 
			
		||||
   xmlns:dc="http://purl.org/dc/elements/1.1/"
 | 
			
		||||
   xmlns:cc="http://creativecommons.org/ns#"
 | 
			
		||||
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 | 
			
		||||
   xmlns:svg="http://www.w3.org/2000/svg"
 | 
			
		||||
   xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
 | 
			
		||||
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
 | 
			
		||||
   xml:space="preserve"
 | 
			
		||||
   width="560"
 | 
			
		||||
   height="560"
 | 
			
		||||
   version="1.1"
 | 
			
		||||
   style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
 | 
			
		||||
   viewBox="0 0 560 560"
 | 
			
		||||
   id="svg44"
 | 
			
		||||
   sodipodi:docname="icon_raw.svg"
 | 
			
		||||
   inkscape:version="0.92.3 (2405546, 2018-03-11)"
 | 
			
		||||
   inkscape:export-filename="/home/umarcor/filebrowser/logo/icon_raw.svg.png"
 | 
			
		||||
   inkscape:export-xdpi="96"
 | 
			
		||||
   inkscape:export-ydpi="96"><metadata
 | 
			
		||||
   id="metadata48"><rdf:RDF><cc:Work
 | 
			
		||||
       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
 | 
			
		||||
         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
 | 
			
		||||
   pagecolor="#ffffff"
 | 
			
		||||
   bordercolor="#666666"
 | 
			
		||||
   borderopacity="1"
 | 
			
		||||
   objecttolerance="10"
 | 
			
		||||
   gridtolerance="10"
 | 
			
		||||
   guidetolerance="10"
 | 
			
		||||
   inkscape:pageopacity="0"
 | 
			
		||||
   inkscape:pageshadow="2"
 | 
			
		||||
   inkscape:window-width="1366"
 | 
			
		||||
   inkscape:window-height="711"
 | 
			
		||||
   id="namedview46"
 | 
			
		||||
   showgrid="false"
 | 
			
		||||
   inkscape:zoom="0.33714286"
 | 
			
		||||
   inkscape:cx="-172.33051"
 | 
			
		||||
   inkscape:cy="280"
 | 
			
		||||
   inkscape:window-x="0"
 | 
			
		||||
   inkscape:window-y="20"
 | 
			
		||||
   inkscape:window-maximized="1"
 | 
			
		||||
   inkscape:current-layer="svg44" />
 | 
			
		||||
  <defs
 | 
			
		||||
   id="defs4">
 | 
			
		||||
    <style
 | 
			
		||||
   type="text/css"
 | 
			
		||||
   id="style2">
 | 
			
		||||
      <![CDATA[
 | 
			
		||||
       .fil1 {fill:#FEFEFE}
 | 
			
		||||
       .fil6 {fill:#006498}
 | 
			
		||||
       .fil7 {fill:#0EA5EB}
 | 
			
		||||
       .fil8 {fill:#2979FF}
 | 
			
		||||
       .fil3 {fill:#2BBCFF}
 | 
			
		||||
       .fil0 {fill:#455A64}
 | 
			
		||||
       .fil4 {fill:#53C6FC}
 | 
			
		||||
       .fil5 {fill:#BDEAFF}
 | 
			
		||||
       .fil2 {fill:#332C2B;fill-opacity:0.149020}
 | 
			
		||||
      ]]>
 | 
			
		||||
    </style>
 | 
			
		||||
  </defs>
 | 
			
		||||
  <g
 | 
			
		||||
   id="g85"
 | 
			
		||||
   transform="translate(-70,-70)"><path
 | 
			
		||||
     class="fil1"
 | 
			
		||||
     d="M 350,71 C 504,71 629,196 629,350 629,504 504,629 350,629 196,629 71,504 71,350 71,196 196,71 350,71 Z"
 | 
			
		||||
     id="path9"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#fefefe" /><path
 | 
			
		||||
     class="fil2"
 | 
			
		||||
     d="M 475,236 593,387 C 596,503 444,639 301,585 L 225,486 339,330 c 0,0 138,-95 136,-94 z"
 | 
			
		||||
     id="path11"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#332c2b;fill-opacity:0.14902003" /><path
 | 
			
		||||
     class="fil3"
 | 
			
		||||
     d="m 231,211 h 208 l 38,24 v 246 c 0,5 -3,8 -8,8 H 231 c -5,0 -8,-3 -8,-8 V 219 c 0,-5 3,-8 8,-8 z"
 | 
			
		||||
     id="path13"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#2bbcff" /><path
 | 
			
		||||
     class="fil4"
 | 
			
		||||
     d="m 231,211 h 208 l 38,24 v 2 L 440,214 H 231 c -4,0 -7,3 -7,7 v 263 c -1,-1 -1,-2 -1,-3 V 219 c 0,-5 3,-8 8,-8 z"
 | 
			
		||||
     id="path15"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#53c6fc" /><polygon
 | 
			
		||||
     class="fil5"
 | 
			
		||||
     points="305,212 418,212 418,310 305,310 "
 | 
			
		||||
     id="polygon17"
 | 
			
		||||
     style="fill:#bdeaff" /><path
 | 
			
		||||
     class="fil5"
 | 
			
		||||
     d="m 255,363 h 189 c 3,0 5,2 5,4 V 483 H 250 V 367 c 0,-2 2,-4 5,-4 z"
 | 
			
		||||
     id="path19"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#bdeaff" /><polygon
 | 
			
		||||
     class="fil6"
 | 
			
		||||
     points="250,470 449,470 449,483 250,483 "
 | 
			
		||||
     id="polygon21"
 | 
			
		||||
     style="fill:#006498" /><path
 | 
			
		||||
     class="fil6"
 | 
			
		||||
     d="m 380,226 h 10 c 3,0 6,2 6,5 v 40 c 0,3 -3,6 -6,6 h -10 c -3,0 -6,-3 -6,-6 v -40 c 0,-3 3,-5 6,-5 z"
 | 
			
		||||
     id="path23"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#006498" /><path
 | 
			
		||||
     class="fil1"
 | 
			
		||||
     d="m 254,226 c 10,0 17,7 17,17 0,9 -7,16 -17,16 -9,0 -17,-7 -17,-16 0,-10 8,-17 17,-17 z"
 | 
			
		||||
     id="path25"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#fefefe" /><path
 | 
			
		||||
     class="fil6"
 | 
			
		||||
     d="m 267,448 h 165 c 2,0 3,1 3,3 v 0 c 0,1 -1,3 -3,3 H 267 c -2,0 -3,-2 -3,-3 v 0 c 0,-2 1,-3 3,-3 z"
 | 
			
		||||
     id="path27"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#006498" /><path
 | 
			
		||||
     class="fil6"
 | 
			
		||||
     d="m 267,415 h 165 c 2,0 3,1 3,3 v 0 c 0,1 -1,2 -3,2 H 267 c -2,0 -3,-1 -3,-2 v 0 c 0,-2 1,-3 3,-3 z"
 | 
			
		||||
     id="path29"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#006498" /><path
 | 
			
		||||
     class="fil6"
 | 
			
		||||
     d="m 267,381 h 165 c 2,0 3,2 3,3 v 0 c 0,2 -1,3 -3,3 H 267 c -2,0 -3,-1 -3,-3 v 0 c 0,-1 1,-3 3,-3 z"
 | 
			
		||||
     id="path31"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#006498" /><path
 | 
			
		||||
     class="fil1"
 | 
			
		||||
     d="m 236,472 c 3,0 5,2 5,5 0,2 -2,4 -5,4 -3,0 -5,-2 -5,-4 0,-3 2,-5 5,-5 z"
 | 
			
		||||
     id="path33"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#fefefe" /><path
 | 
			
		||||
     class="fil1"
 | 
			
		||||
     d="m 463,472 c 3,0 5,2 5,5 0,2 -2,4 -5,4 -3,0 -5,-2 -5,-4 0,-3 2,-5 5,-5 z"
 | 
			
		||||
     id="path35"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#fefefe" /><polygon
 | 
			
		||||
     class="fil6"
 | 
			
		||||
     points="305,212 284,212 284,310 305,310 "
 | 
			
		||||
     id="polygon37"
 | 
			
		||||
     style="fill:#006498" /><path
 | 
			
		||||
     class="fil7"
 | 
			
		||||
     d="m 477,479 v 2 c 0,5 -3,8 -8,8 H 231 c -5,0 -8,-3 -8,-8 v -2 c 0,4 3,8 8,8 h 238 c 5,0 8,-4 8,-8 z"
 | 
			
		||||
     id="path39"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#0ea5eb" /><path
 | 
			
		||||
     class="fil8"
 | 
			
		||||
     d="M 350,70 C 505,70 630,195 630,350 630,505 505,630 350,630 195,630 70,505 70,350 70,195 195,70 350,70 Z m 0,46 C 479,116 584,221 584,350 584,479 479,584 350,584 221,584 116,479 116,350 116,221 221,116 350,116 Z"
 | 
			
		||||
     id="path41"
 | 
			
		||||
     inkscape:connector-curvature="0"
 | 
			
		||||
     style="fill:#2979ff" /></g>
 | 
			
		||||
</svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 5.4 KiB  | 
@ -0,0 +1,31 @@
 | 
			
		||||
---
 | 
			
		||||
display_name: File Browser
 | 
			
		||||
description: A file browser for your workspace
 | 
			
		||||
icon: ../.icons/filebrowser.svg
 | 
			
		||||
maintainer_github: coder
 | 
			
		||||
verified: true
 | 
			
		||||
tags: [helper, filebrowser]
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# File Browser
 | 
			
		||||
 | 
			
		||||
A file browser for your workspace.
 | 
			
		||||
 | 
			
		||||
```hcl
 | 
			
		||||
module "filebrowser" {
 | 
			
		||||
    source = "https://registry.coder.com/modules/filebrowser"
 | 
			
		||||
    agent_id = coder_agent.example.id
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Examples
 | 
			
		||||
 | 
			
		||||
### Serve a specific directory
 | 
			
		||||
 | 
			
		||||
```hcl
 | 
			
		||||
module "filebrowser" {
 | 
			
		||||
    source = "https://registry.coder.com/modules/filebrowser"
 | 
			
		||||
    agent_id = coder_agent.example.id
 | 
			
		||||
    folder = "/home/coder/project"
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
@ -0,0 +1,63 @@
 | 
			
		||||
terraform {
 | 
			
		||||
  required_version = ">= 1.0"
 | 
			
		||||
 | 
			
		||||
  required_providers {
 | 
			
		||||
    coder = {
 | 
			
		||||
      source  = "coder/coder"
 | 
			
		||||
      version = ">= 0.12"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Add required variables for your modules and remove any unneeded variables
 | 
			
		||||
variable "agent_id" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "The ID of a Coder agent."
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "log_path" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "The path to log filebrowser to."
 | 
			
		||||
  default     = "/tmp/filebrowser.log"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "port" {
 | 
			
		||||
  type        = number
 | 
			
		||||
  description = "The port to run filebrowser on."
 | 
			
		||||
  default     = 19999
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
variable "folder" {
 | 
			
		||||
  type        = string
 | 
			
		||||
  description = "The folder to serve."
 | 
			
		||||
  default     = "~"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "coder_script" "filebrowser" {
 | 
			
		||||
  agent_id     = var.agent_id
 | 
			
		||||
  display_name = "filebrowser"
 | 
			
		||||
  icon         = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg"
 | 
			
		||||
  script = templatefile("${path.module}/run.sh", {
 | 
			
		||||
    LOG_PATH : var.log_path,
 | 
			
		||||
    PORT : var.port,
 | 
			
		||||
    FOLDER : var.folder,
 | 
			
		||||
  })
 | 
			
		||||
  run_on_start = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
resource "coder_app" "filebrowser" {
 | 
			
		||||
  agent_id     = var.agent_id
 | 
			
		||||
  slug         = "filebrowser"
 | 
			
		||||
  display_name = "filebrowser"
 | 
			
		||||
  url          = "http://localhost:${var.port}"
 | 
			
		||||
  icon         = "https://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svg"
 | 
			
		||||
  subdomain    = false
 | 
			
		||||
  share        = "owner"
 | 
			
		||||
 | 
			
		||||
  # Remove if the app does not have a healthcheck endpoint
 | 
			
		||||
  healthcheck {
 | 
			
		||||
    url       = "http://localhost:${var.port}/healthz"
 | 
			
		||||
    interval  = 5
 | 
			
		||||
    threshold = 6
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,20 @@
 | 
			
		||||
#!/usr/bin/env sh
 | 
			
		||||
 | 
			
		||||
BOLD='\033[0;1m'
 | 
			
		||||
echo "$${BOLD}Installing filebrowser..."
 | 
			
		||||
 | 
			
		||||
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
 | 
			
		||||
 | 
			
		||||
echo "🥳 Installation comlete!"
 | 
			
		||||
 | 
			
		||||
echo "👷 Starting filebrowser in background..."
 | 
			
		||||
 | 
			
		||||
# if FOLDER is ~ then use $HOME
 | 
			
		||||
if [ "${FOLDER}" = "~" ]; then
 | 
			
		||||
    FOLDER=$HOME
 | 
			
		||||
else
 | 
			
		||||
    FOLDER=${FOLDER}
 | 
			
		||||
fi
 | 
			
		||||
filebrowser --noauth --root $FOLDER --port ${PORT} >/tmp/filebrowser.log >${LOG_PATH} 2>&1 &
 | 
			
		||||
 | 
			
		||||
echo "check logs at ${LOG_PATH}"
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue