Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 15, 2025. It is now read-only.
/modulesPublic archive

feat(filebrowser): check if already installed#334

Merged
matifali merged 6 commits intocoder:mainfromIamTaoChen:main
Oct 30, 2024

Conversation

IamTaoChen
Copy link
Contributor

Add check if thefilebrowser exist

@matifalimatifali changed the titleFilebrowser will only be installed if it doesn’t exist on the system.feat(filebrowser): check if already installedOct 28, 2024
Copy link
Member

@matifalimatifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for the contribution.
Can you please runbun update-version or./scripts/update-version.sh.

IamTaoChen reacted with thumbs up emoji
@IamTaoChen
Copy link
ContributorAuthor

Done

@matifali
Copy link
Member

Hi@IamTaoChen could you also runbun install && bun fmt?
Then runbun test filebrowser/main.test.ts with docker installed to run tests for the module. Make sure they pass.

@IamTaoChen
Copy link
ContributorAuthor

During testing, I encountered an error in main.tf related to the variable validation logic:

modules2 git:(main) ✗ buntest filebrowser/main.test.ts --verbosebuntest v1.1.33 (247456b6)filebrowser/main.test.ts:Terraform encountered problems during initialisation, including problemswith the configuration, described below.The Terraform configuration must be valid before initialization so thatTerraform can determine which modules and providers need to be installed.╷│ Error: Invalid referencein variable validation│ │   on main.tf line 27,in variable"agent_name":│   27:     condition     = var.subdomain|| var.agent_name!=""│ │ The conditionfor variable"agent_name" can only refer to the variable itself, using var.agent_name.╵

Terraform’s validation rules don’t allow a variable’s validation logic to reference other variables, such asvar.subdomain. If I comment out or mask this part of the code, the test passes successfully. However, I’m unsure if masking it in this PR is the right approach.

Should I proceed by temporarily masking the validation to unblock the tests, or would you recommend another way to handle this dependency.

@matifali
Copy link
Member

matifali commentedOct 30, 2024
edited
Loading

@IamTaoChen Let us remove thevalidation fromagent_name and make it an optional variable with a default set tonull.

I am actually doing some changes inhttps://github.com/coder/modules/blob/atif/qol-improvments/filebrowser/main.tf

Feel free to bring them in for filebrowser in your PR.

@IamTaoChen
Copy link
ContributorAuthor

Now, it passed the test

matifali reacted with thumbs up emoji

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, thanks for your contribution!

printf "$${BOLD}Installing filebrowser \n\n"

curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
# Check if filebrowser is installed
if ! command -v filebrowser &> /dev/null; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

(No action, just commentary.)

This is nice, but unfortunately it's rare that users will benefit since it's usually installed to/usr/local/bin. For containers it's rarely persisted.

It'd be cool if we could store this in$CODER_SCRIPT_BIN_DIR instead. Usually this is within/tmp but it's possible to change by starting the coder agent withCODER_AGENT_SCRIPT_DATA_DIR=/path/to/persistent/dir.

This is something to consider for all modules, should we track this in a new issue@matifali?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is nice, but unfortunately it's rare that users will benefit since it's usually installed to /usr/local/bin. For containers it's rarely persisted.

For air-gapped scenarios where the image already has it installed this is beneficial.

It'd be cool if we could store this in $CODER_SCRIPT_BIN_DIR instead. Usually this is within /tmp but it's possible to change by starting the coder agent with CODER_AGENT_SCRIPT_DATA_DIR=/path/to/persistent/dir.

I am a bit confused about $CODER_SCRIPT_BIN_DIR and $CODER_AGENT_SCRIPT_DATA_DIR. Do we have them already and how are the used? Or are you proposing this new concept.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For air-gapped scenarios where the image already has it installed this is beneficial.

👍🏻

I am a bit confused about $CODER_SCRIPT_BIN_DIR and $CODER_AGENT_SCRIPT_DATA_DIR. Do we have them already and how are the used? Or are you proposing this new concept.

We have them.

Let's say you run the agent this way:

coder agent --script-data-dir=/home/coder/.local/coder-script

Now all coder scripts will be executed with the following environment variables:

CODER_SCRIPT_DATA_DIR=/home/coder/.local/coder-script/[UUID]CODER_SCRIPT_BIN_DIR=/home/coder/.local/coder-script/bin

And the coder agent will automatically add/home/coder/.local/coder-script/bin to thePATH.

Even without specifying the script dir, a default will be used, you can verify this in your workspace:

ls /tmp/coder-script-data

matifali reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is super useful and we should start using it in our modules.

@matifalimatifali merged commitf5ab799 intocoder:mainOct 30, 2024
2 checks passed
@IamTaoChen
Copy link
ContributorAuthor

Hi I just noticed that/icon/filebrowser.svg doesn't exist on version of 2.16

johnstcn added a commit to coder/coder that referenced this pull requestNov 4, 2024
Fixes#15365We used to hithttps://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svgfor the filebrowser icon butcoder/modules#334 modified the icon URL topoint to a self-hosted icon.I simply copied the icon from the `coder/modules` repo.
stirby pushed a commit to coder/coder that referenced this pull requestNov 4, 2024
Fixes#15365We used to hithttps://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svgfor the filebrowser icon butcoder/modules#334 modified the icon URL topoint to a self-hosted icon.I simply copied the icon from the `coder/modules` repo.(cherry picked from commitdc29b81)
stirby added a commit to coder/coder that referenced this pull requestNov 4, 2024
Fixes#15365We used to hithttps://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svgfor the filebrowser icon butcoder/modules#334 modified the icon URL topoint to a self-hosted icon.I simply copied the icon from the `coder/modules` repo.(cherry picked from commitdc29b81)Co-authored-by: Cian Johnston <cian@coder.com>
johnstcn added a commit to coder/coder that referenced this pull requestNov 25, 2024
Fixes#15365We used to hithttps://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svgfor the filebrowser icon butcoder/modules#334 modified the icon URL topoint to a self-hosted icon.I simply copied the icon from the `coder/modules` repo.(cherry picked from commitdc29b81)
johnstcn added a commit to coder/coder that referenced this pull requestNov 25, 2024
Fixes#15365We used to hithttps://raw.githubusercontent.com/filebrowser/logo/master/icon_raw.svgfor the filebrowser icon butcoder/modules#334 modified the icon URL topoint to a self-hosted icon.I simply copied the icon from the `coder/modules` repo.(cherry picked from commitdc29b81)
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@matifalimatifalimatifali approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@IamTaoChen@matifali@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp