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

Spin up #34

Open
kingdonb opened this issue Jul 9, 2023 · 8 comments
Open

Spin up #34

kingdonb opened this issue Jul 9, 2023 · 8 comments

Comments

@kingdonb
Copy link

kingdonb commented Jul 9, 2023

I see mentioned in the readme that spin up is supported, but from the contribution points of the extension and from the source it looks like only spin deploy actually is in the extension now, there's no way to call spin up in the extension, without using the terminal.

Is this an oversight or is it coming soon?

💯 Great job with Spin SDK and documentation!

I got bart.exe compiled on a Windows machine today, which we are using to kickstart development with Wasm on Spin. There is honestly not much you need a bart.exe for, and I'll concede that, but it is on the critical path for the tutorial, and so I was prompted to download and install Rust

I had to use an older version of Rust to compile Bartholomew because of some dependency that had been using a now deprecated and removed feature. It was a challenge to figure out from the error message on Rust 1.70.0. I wish the Spin extension could also install the latest version of bart.exe and spin.exe, (but first Bartholomew would have to publish a Windows exe as release 🙏 💭 💸 )

It probably isn't that important, and certainly ticket should go somewhere else, but I wondered if the spin-vscode app would have Bartholomew usability in scope, since it's unlikely you'd create another extension for Bart

We are having a great time with the Bartholomew blog and just found bartholomew-sample – this is a great springboard for a blog! I think a lot of people might be tricked into trying Wasm development if you can get them using Bartholomew first. I certainly wasn't really sure what immediate use I'd have for Fermyon Cloud until it started to seem like Bartholomew was a really viable option for building our own website, (which it does, and we are!)

@itowlson
Copy link
Collaborator

itowlson commented Jul 9, 2023

It's done using the VS Code task system rather than as a custom command. Choose Tasks: Run Task then choose spin from the folder list.

Thanks for the kind words. The extension does install Spin by default, but I just realised it is still on 0.8, which is quite old (at least by Spin standards), which is quite old (at least by Spin standards). I'd recommend using spin.customProgramPath to point it at your Spin installation until I update it! Installing Bartholomew is out of scope for the Spin VS Code extension, but we can have a think about how to make this a friendlier experience. A Bart-specific extension, more focused around Markdown scaffolding and checking than around Spin application development, would certainly be a better way to go, just need to find the time to figure out what the features would look like.

I'll flag up the Rust versioning issue on the Bartholomew repo - thanks for letting us know.

Thanks again for the positive feedback and I'm glad you're having fun!

@kingdonb
Copy link
Author

We did wind up finding bart check later in the trial runs, it helped when the pages weren't rendering and got us back moving. That all sounds like it would be helpful! Thanks for looking into this 💯

@kingdonb
Copy link
Author

kingdonb commented Jul 10, 2023

I tried the "run task" workflow and I got an error:

 *  Executing task: PLACEHOLDER  


 *  The terminal process failed to launch: Path to shell executable "PLACEHOLDER" does not exist. 

I think this indicates that... "this cannot be right"

const exec = new vscode.ProcessExecution("PLACEHOLDER"); // TODO: THIS CANNOT BE RIGHT

... as it says here in this TODO ;) I did fill out the extension setting with the path of my spin binary ahead of time, but not sure if it worked.

IDK how this handle can be highlighted better in the docs exactly, but it looks like it will fill the bill once it works!

I also had problems with spin watch as it didn't seem to be reloading. We also had some surprising errors with spin up and spin watch both, that seemed to resolve when we enabled transient writes (but both required a manual restart before serving up the changes, either one seemed to be detecting changes and going into refuse connection mode until it was restarted manually). Not sure what caused the need for either of those.

I believe we were indeed on the latest version of Spin, as we figured all that out before finding the extension 👍 1.3.0

@kingdonb
Copy link
Author

I am a maintainer for the Flux "GitOps Tools" extension, so maybe there's some work I can do to help out here. Feel free to @ me on issues that come out of this thread in any repo, and if I have any idea how to solve them I'll be glad to give it a shot!

@itowlson
Copy link
Collaborator

@kingdonb Thanks for reporting this. I am not sure what is happening with the task and the PLACEHOLDER; it's meant to inject the Spin path at time of use. But no, it's not working for me either at the moment (the dreaded "it used to work and I didn't change anything"). I apologise for this, and I'm sorry it's inconvenienced you.

Transient writes should only be needed if you need to write back to something in your component.files. I didn't think Bartholomew needed to do that, though I'm not very familiar with it. If you have time to share the error I can raise an issue over there.

Thanks for the kind offer of help and for sharing the woe (and for your patience) - I'll reach out if I have something you can try out (or if I'm stumped!).

@itowlson
Copy link
Collaborator

I think there is something happening where if I do Tasks > Run Task and choose from the folder, VS Code calls only provideTask, not resolveTask. Whereas if I use the MRU task list, it calls resolveTask. And the extension relies on resolveTask - the reason being that if it waits for a path to be available in provideTask then that can result in unresponsiveness during "Configure Task."

I'm still not 100% sure what the flow is in the different situations, as my logging is showing gaps where no gaps should be possible, but I think that's what's going on here... next stop, what to do about it!

@kingdonb
Copy link
Author

kingdonb commented Jul 10, 2023

Sure I'm happy to share, I've been working from https://github.com/coderoflagos/bartholomew-sample

I have to admit that I am the less competent in typescript of our two active VSCode extension admins, so it's still not clear to me what's wrong although I'm glad you can reproduce the error, not just "doesn't work on my machine" 😄

I haven't modified this repo at all, only cloned it. My machine is a MacOS M1 Ventura 13.4.1, and my partner in crime (wife with the blog) is running Windows 10 without WSL. (There is a WSL installed in case it is needed, but we aren't using it.)

If I run spin up then I get:

$ spin up
Logging component stdio to ".spin/logs/"
Preparing Wasm modules is taking a few seconds...


Serving http://127.0.0.1:3000
Available Routes:
  bartholomew: http://127.0.0.1:3000 (wildcard)
  fileserver: http://127.0.0.1:3000/static (wildcard)
Request path: /index
Base URL: Some("http://localhost:3000")
scripts: registering get_page
scripts: registering blogs
Path /content/index.md
Skipping dotfile "/content/.DS_Store"
Skipping dotfile "/content/blog/.DS_Store"
Handler returned an error: Rendering "/content/index.md": Operation not permitted (os error 63)
Request path: /favicon.ico
Base URL: Some("http://localhost:3000")
scripts: registering get_page
scripts: registering blogs
Path /content/favicon.md
Skipping dotfile "/content/.DS_Store"
Skipping dotfile "/content/blog/.DS_Store"
Handler returned an error: Operation not permitted (os error 63)
$ spin --version
spin 1.3.0 (9fb8256 2023-06-12)

On the web page, we get:

Rendering "/content/index.md": Operation not permitted (os error 63)

I can confirm that the issue resolves when I run spin up --allow-transient-write

I honestly haven't tried spin deploy on this repo yet, we're trying to make the website a bit nice before we put it out there at a publicly accessible URL – but it should go live soon at this rate

None of these woes rise to the level of full-on inconvenience, and I've been around the block with Spin enough times that these were "all things I thought to try without struggling for too long"

It's nice that there aren't too many options on the spin (and bart) CLI itself 👍

These are the file permissions in case it matters:

$ ls -l content/
total 16
drwxr-xr-x  5 kingdonb  staff  160 Jul  9 12:39 blog/
-rw-r--r--  1 kingdonb  staff  247 Jul  9 12:39 blog.md
-rw-r--r--  1 kingdonb  staff  911 Jul  9 12:39 index.md

@itowlson
Copy link
Collaborator

Issue raised (fermyon/bartholomew#175) - thanks for all the detail!

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

No branches or pull requests

2 participants