Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Submission: Samba #1161

Merged
merged 14 commits into from
Jul 30, 2024
Merged

Conversation

joaovictor-local
Copy link
Contributor

@joaovictor-local joaovictor-local commented Jun 18, 2024

I am already using it through a community store (https://github.com/joaovictor-local/umbrel-samba-app-store) but it requires me to change the password manually editing the files using SSH, before that I was using Samba directly installed on the host but it was deleted by a system update so I had to figure out how to eliminate this problem.

I think it need at least to generate a random password for each installation, maybe a script to generate the password and insert it at the /data files and the umbrel-app.yml ✔️ our allow the user to sign in using his Umbrel password (I not sure if it's possible on Linux)

What do you guys think about the idea of this app? A web app to edit the config file and password would be cool too and I think I could code it. If we it would be possible to use the same password we would just need a better index.html.

Icon: getumbrel/umbrel-apps-gallery#47

Copy link
Contributor

@sharknoon sharknoon left a comment

Choose a reason for hiding this comment

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

Hi @joaovictor-local,

thank you so much for your awesome app submission, I am really impressed! I also think this app is needed as umbrelOS currently has no app to export its storage via samba.

I have left a couple of suggestions below. If you have any questions, feel free to ask me anytime.

Note: I haven't tested the app yet, but I will do that as soon as you have updated this PR 😀

Thanks again for your awesome work, I can't wait to see your changes!

@joaovictor-local
Copy link
Contributor Author

Hi @joaovictor-local,

thank you so much for your awesome app submission, I am really impressed! I also think this app is needed as umbrelOS currently has no app to export its storage via samba.

I have left a couple of suggestions below. If you have any questions, feel free to ask me anytime.

Note: I haven't tested the app yet, but I will do that as soon as you have updated this PR 😀

Thanks again for your awesome work, I can't wait to see your changes!

Hi @sharknoon!
I appreciate! Thank you for you review 😄 I applied all your requests.

image

Copy link
Contributor

@sharknoon sharknoon left a comment

Choose a reason for hiding this comment

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

Wow, awesome work! You are really fast!

I have tested it on my umbrel and it worked flawlessly. I think I will keep this app on my personal umbrel :)

I have made some suggestions below. It can happen, that the user change (user: "1000:1000") in the docker compose file will not work. Please test if it workd with less permissions and let me know.

Thank you again :)

@joaovictor-local
Copy link
Contributor Author

Wow, awesome work! You are really fast!

I have tested it on my umbrel and it worked flawlessly. I think I will keep this app on my personal umbrel :)

I have made some suggestions below. It can happen, that the user change (user: "1000:1000") in the docker compose file will not work. Please test if it workd with less permissions and let me know.

Thank you again :)

I am excited to see it available in the store 😄
It worked fine with less permission for the Static Web Server too 👍

Copy link
Contributor

@sharknoon sharknoon left a comment

Choose a reason for hiding this comment

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

Really good work @joaovictor-local! I have found two small issues. After that, I think we are good to go 😀 It will take some time, until the app is in the app store, because this app gets custom made gallery images.

Copy link
Contributor

@sharknoon sharknoon left a comment

Choose a reason for hiding this comment

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

Awesome work, looks good to me 🎉

@nmfretz can you have a second look if everything looks okay from your side?

Thank you @joaovictor-local for submitting such a great and (in my opinion) much needed app

@joaovictor-local
Copy link
Contributor Author

@nmfretz
Copy link
Contributor

nmfretz commented Jun 25, 2024

Hey @joaovictor-local, sorry for the delay on my end. I will look at this tomorrow!

@nmfretz
Copy link
Contributor

nmfretz commented Jun 27, 2024

Wonderful addition @joaovictor-local! And fantastic review @sharknoon. I'm super impressed with both of you here 🤝

@joaovictor-local this is working really well. We'll start getting gallery assets together so this can go live!

In the meantime, there are a couple things you may want to do to make app updates easier for you:

1) Include the public assets (favicon/index.html/samba.svg) within the homepage Docker image itself.

Ideally, the best thing to do is have your frontend code be part of the Docker image so that frontend app updates are as easy as changing the image key in the compose file to your new image.

The way umbrelOS currently works is that on app install, everything from the app's repo is copied over to a users umbrel data. But on app updates only a whitelist of files is copied over so that user data is not overwritten:
https://github.com/getumbrel/umbrel/blob/49d37581c8233f808fc5a79c2cd38810c6cd1b0b/packages/umbreld/source/modules/apps/legacy-compat/app-script#L594-L595

With the current configuration, if you made changes to your UI (e.g., changed the instructions in the html), only new installs would receive the updates. Existing installs that update won't get the changes. You could do some hacky things like use a hook that runs on app update and changes certain files, but it's not ideal because it will add complex overhead for you.

Instead, what you can do is just build your own image from joseluisq/static-web-server that includes your public folder and then push it to DockerHub.

Something as simple as this will likely work for a Dockerfile:

# Use the joseluisq/static-web-server as the base image
# You'll want to update this tag to the latest version each time you build
FROM joseluisq/static-web-server:2.32.0

# Copy your entire public directory to the /var/public directory which is set by the SERVER_ROOT env var
COPY public /var/public

You'll then need to make sure to build a multi-architecture image for amd64 and arm64. You'll run something like this:

docker buildx build --platform linux/amd64,linux/arm64 -t your-docker-hub-username/static-web-server-samba:version-tag .

2) Can the Samba container create it's own smb.conf and we still bind to it?

It might be worth seeing if it's possible to let the Samba container create it's own smb.conf on initial startup, still have us bind to its parent directory, but also allow us to set the things we need to change via environment variables (e.g., force user).

I suspect this won't be possible, so please don't do too much digging. The thing I'm trying to avoid here is again related to app updates not bringing down changes we may need to make to this file at some point down the road.

I'm going to make a couple small changes to the compose file and push them.

@nmfretz
Copy link
Contributor

nmfretz commented Jun 27, 2024

Alrighty @joaovictor-local I made two main changes:

  1. I changed the smb.conf bind mount path on the host to ${APP_DATA_DIR}/data/samba/smb.conf 541476a

  2. I changed the SMB port from 445 to 446.
    This is needed because the Back That Mac Up app is already using 445. If a user goes to install both apps then the second one that is being installed will fail because port 445 will already be in use.

    This means that the instructions in the index.html will need to change to reference smb://umbrel.local:446

Copy link
Contributor

Choose a reason for hiding this comment

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

I have checked the default smb.conf in the container and it seems like the only difference is the force user and force group keys. Both of which can set by environment variables. The only reason I can think of to keep this file then in the repository, is to allow advanced users to edit this file. I am not sure, maybe we can remove this file altogether and tell advanced users to modify the docker-compose.yml directly.

Comment on lines 325 to 328
<p>For more detailed configuration information, <a href="smb.conf">click here to check your config file</a>.
You can change the config by opening the terminal (Settings -> Advanced Settings -> Terminal) and manually
modifying the smb file (e.g. with nano umbrel/app-data/samba/data/smb.conf).
</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

If we decide to leave out the smb.conf altogether, we should change this description and tell users to edit the docker-compose.yml directly in order to add a custom smb.conf file.

@sharknoon
Copy link
Contributor

@joaovictor-local 👀

@joaovictor-local
Copy link
Contributor Author

@joaovictor-local 👀

I will be doing it today yet (UTC-3).
🙂

@joaovictor-local
Copy link
Contributor Author

@sharknoon the only problem with the docker-compose.yml edit it that it will be erased after a update and the user may forget that we need to put it back manually. I have changed the force user and force group keys just for informative proposal because it will always use the values in the environment variables.

@sharknoon
Copy link
Contributor

@joaovictor-local thank you for your commits 😀 Yes, you are right, changes to the docker-compose.yml will be erased after an update.

smb.conf

I am thinking do we need to have a smb.conf exposed to the user? What are the use cases for a user to edit this file? I am not an expert in Samba, maybe you can clarify it a bit for me, thanks! 😊

Container Image

Would it be possible for you to pack the UI part inside a container as @nmfretz suggested it? That way it is easier to update and maintain. We would also have a clear line of responsibilities (everything feature/app releated inside the container, everything hosting/umbrel related in the data directory/docker compose).

Updated Port

Other than that we had to change to port from the standard 445 to 446, because that port was already allocated by Back That Mac Up. Therefore we also need to change the port in the UI.

Thank you so much for the great work you are doing and I can't wait to see this app on the app store!

@joaovictor-local
Copy link
Contributor Author

joaovictor-local commented Jun 30, 2024

@joaovictor-local thank you for your commits 😀 Yes, you are right, changes to the docker-compose.yml will be erased after an update.

smb.conf

I am thinking do we need to have a smb.conf exposed to the user? What are the use cases for a user to edit this file? I am not an expert in Samba, maybe you can clarify it a bit for me, thanks! 😊

Container Image

Would it be possible for you to pack the UI part inside a container as @nmfretz suggested it? That way it is easier to update and maintain. We would also have a clear line of responsibilities (everything feature/app releated inside the container, everything hosting/umbrel related in the data directory/docker compose).

Updated Port

Other than that we had to change to port from the standard 445 to 446, because that port was already allocated by Back That Mac Up. Therefore we also need to change the port in the UI.

Thank you so much for the great work you are doing and I can't wait to see this app on the app store!

  1. You may want to change it to make it faster.
    https://www.reddit.com/r/OpenMediaVault/comments/11gwi1g/significant_samba_speedperformance_improvement_by/

  2. I was working on it but I had to take a break. Take a lot in the last commit and also: https://github.com/joaovictor-local/static-web-server-samba and https://hub.docker.com/repository/docker/loficafe/static-web-server-samba/general.

  3. @nmfretz changed it for me :)

@sharknoon
Copy link
Contributor

Hey @joaovictor-local

I am sorry to answer so late, I haven't forgotten your PR.

Great work on the docker image, it looks awesome! The Ports in the UI are also changed 😃

It looks good to me 👍

@joaovictor-local
Copy link
Contributor Author

@nmfretz Can you take another look? Did we need to wait something else before merging?

@nmfretz
Copy link
Contributor

nmfretz commented Jul 9, 2024

Thanks for the ping @joaovictor-local and very sorry for the delay on my end while I was working on other things. We'll get gallery assets made up and then send this live to the app store. Really really great work!

@loralb
Copy link

loralb commented Jul 22, 2024

Hello, sorry for the ping, but how long do gallery assets usually take to generate?

Copy link

🎉   Linting finished with no errors or warnings   🎉

Thank you for your submission! This is an automated linter that checks for common issues in pull requests to the Umbrel App Store.

Please review the linting results below and make any necessary changes to your submission.

Linting Results

Severity File Description
ℹ️ samba/docker-compose.yml External port mapping "446:445":
Port mappings may be unnecessary for the app to function correctly. Docker's internal DNS resolves container names to IP addresses within the same network. External access to the web interface is handled by the app_proxy container. Port mappings are only needed if external access is required to a port not proxied by the app_proxy, or if an app needs to expose multiple ports for its functionality (e.g., DHCP, DNS, P2P, etc.).

Legend

Symbol Description
Error: This must be resolved before this PR can be merged.
⚠️ Warning: This is highly encouraged to be resolved, but is not strictly mandatory.
ℹ️ Info: This is just for your information.

@nmfretz
Copy link
Contributor

nmfretz commented Jul 30, 2024

@joaovictor-local gallery assets are now live!
https://github.com/getumbrel/umbrel-apps-gallery/tree/master/samba

Thanks so much for your patience and for your excellent work in bringing Samba to the app store. Going live 🎉

image

@nmfretz nmfretz merged commit e51e413 into getumbrel:master Jul 30, 2024
1 check passed
@a4004
Copy link
Contributor

a4004 commented Aug 1, 2024

Hey, just came across your project due to an issue raised in the Discord @joaovictor-local

You may want to consider using the default SMB port 445 instead of using 446 because unfortunately for some bizzare reason, Windows is unable to connect to the fileshare when using non-standard SMB/CIFS port numbers. This has been the case for one Umbrel user today, and I've experienced the same issue when testing.

I know this might cause a port conflict with the Back That Mac Up app so that could be a non-solution, but something to consider.

It is a known issue with Windows itself, dating back to Windows 7 as far as I could see so maybe changing the instructions at the very least, to suggesting setting up something like CIFS over SSH or the answer from the user Hashbrown on this thread,

All in all nice app! 🚀

Edit:

@sharknoon
Copy link
Contributor

@joaovictor-local Could you update your image loficafe/static-web-server-samba to change the usage instructions for the windows version? As @a4004 pointed out, the instructions don't work on windows. Maybe you could replace the windows description with the suggestions by @a4004.

As soon as the new umbrelOS app framework will be released with proper handling for port conflicts, this is unfortunately the only solution we can give.

@DJMo13
Copy link

DJMo13 commented Nov 1, 2024

Hello, would it be possible to create an incomparability tab in the app store and make back-my-mac-up and samba run on the same port 445?

@kroese kroese mentioned this pull request Nov 24, 2024
@nmfretz nmfretz mentioned this pull request Feb 12, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants