cloudflare / Stout

A reliable static website deploy tool
MIT License
752 stars 29 forks source link

Deploy does not correctly work on Windows #13

Closed gglanzani closed 8 years ago

gglanzani commented 8 years ago

Hi there,

when trying to deploy I get the above error. In case you want to try with my folder structure:

http://www.lanzani.nl.s3.amazonaws.com/public/public.zip

Edit: I'm executing the command:

stout.exe deploy --bucket blog.lanzani.nl --key $KEY --secret $SECRET --root public --region eu-west-1
zackbloom commented 8 years ago

This is interesting. We are certainly attempting to include the bucket name (the last parameter here). If you have the capability of running Stout from it's source, I would love to know what filepath.Join(bucket.Name, from) is when that function runs.

gglanzani commented 8 years ago

You mean calling printf on filepath.Join(bucket.Name, from)? I'll try, but it'll take me some time (I need to setup go in my machine first)

zackbloom commented 8 years ago

log.Println(filepath.Join(bucket.Name, from)), yes. That would be very helpful, thank you.

On Mon, Nov 30, 2015 at 4:01 PM, Giovanni Lanzani notifications@github.com wrote:

You mean calling printf on filepath.Join(bucket.Name, from)? I'll try, but it'll take me some time (I need to setup go in my machine first)

— Reply to this email directly or view it on GitHub https://github.com/EagerIO/Stout/issues/13#issuecomment-160760549.

gglanzani commented 8 years ago

Ok, this seems to be the output (second line is result of adding filepath.Join(bucket.Name, from)

2015/12/03 17:23:21 Copying af7dda1c28b8\test.html to test.html
2015/12/03 17:23:21 test.lanzani.nl\af7dda1c28b8\test.html

+------------------------------------+
|         panic: Copy Source must mention the source bucket and key: sourcebucket/sourcekeyDeploy Successful!         |

|                                    |

|       Deploy ID: goroutine af7dda1c28b8      |
67+------------------------------------+
 [running]:
main.copyFile(0xc0823fa180, 0xc0823fa160, 0x16, 0xc082429cd0, 0x9, 0x8907b0, 0x9, 0x3c)
        C:/code/go/src/github.com/EagerIO/Stout/src/utils.go:214 +0x509
main.deployHTML(0x876330, 0x1, 0xc0820042c0, 0x4, 0x8764f8, 0x2, 0x0, 0x0, 0x0, 0x0, ...)
        C:/code/go/src/github.com/EagerIO/Stout/src/deploy.go:365 +0x737
main.Deploy.func1(0xc082429c30, 0xc08205b040, 0xc082005fe0, 0xc082005ef0, 0xe, 0xc082005f90, 0x9, 0x0, 0x0, 0xace950, ...)
        C:/code/go/src/github.com/EagerIO/Stout/src/deploy.go:591 +0x98
created by main.Deploy
        C:/code/go/src/github.com/EagerIO/Stout/src/deploy.go:592 +0x4de

goroutine 1 [panicwait]:
runtime.gopark(0x0, 0x0, 0x88db80, 0x9, 0x10, 0x1)
        c:/go/src/runtime/proc.go:185 +0x17c
runtime.main()
        c:/go/src/runtime/proc.go:121 +0x2c2
runtime.goexit()
        c:/go/src/runtime/asm_amd64.s:1696 +0x1
zackbloom commented 8 years ago

Ah ha! The issue is the Windows file path separator being incompatible with S3's forward slashes. Thanks for helping debug!

On Thu, Dec 3, 2015 at 11:28 AM, Giovanni Lanzani notifications@github.com wrote:

Ok, this seems to be the output (second line is result of adding filepath.Join(bucket.Name, from)

2015/12/03 17:23:21 Copying af7dda1c28b8\test.html to test.html 2015/12/03 17:23:21 test.lanzani.nl\af7dda1c28b8\test.html

+------------------------------------+ panic: Copy Source must mention the source bucket and key: sourcebucket/sourcekeyDeploy Successful!
Deploy ID: goroutine af7dda1c28b8

67+------------------------------------+ [running]: main.copyFile(0xc0823fa180, 0xc0823fa160, 0x16, 0xc082429cd0, 0x9, 0x8907b0, 0x9, 0x3c) C:/code/go/src/github.com/EagerIO/Stout/src/utils.go:214 +0x509 main.deployHTML(0x876330, 0x1, 0xc0820042c0, 0x4, 0x8764f8, 0x2, 0x0, 0x0, 0x0, 0x0, ...) C:/code/go/src/github.com/EagerIO/Stout/src/deploy.go:365 +0x737 main.Deploy.func1(0xc082429c30, 0xc08205b040, 0xc082005fe0, 0xc082005ef0, 0xe, 0xc082005f90, 0x9, 0x0, 0x0, 0xace950, ...) C:/code/go/src/github.com/EagerIO/Stout/src/deploy.go:591 +0x98 created by main.Deploy C:/code/go/src/github.com/EagerIO/Stout/src/deploy.go:592 +0x4de

goroutine 1 [panicwait]: runtime.gopark(0x0, 0x0, 0x88db80, 0x9, 0x10, 0x1) c:/go/src/runtime/proc.go:185 +0x17cruntime.main() c:/go/src/runtime/proc.go:121 +0x2c2runtime.goexit() c:/go/src/runtime/asm_amd64.s:1696 +0x1

— Reply to this email directly or view it on GitHub https://github.com/EagerIO/Stout/issues/13#issuecomment-161705757.

gglanzani commented 8 years ago

You're welcome! I think (hope) that's an easy fix, as I'm really looking forward to use Stout!

And now I know how to compile it myself ;)

zackbloom commented 8 years ago

I have a very theoretical fix here, which uses Unix-style paths for everything: https://github.com/EagerIO/Stout/tree/filepath

Frankly though, my guess is we're gonna have to use os-dependent paths for local files, and Unix-style ones for remote paths. It's hard for me to test though, as I don't have a Windows machine. My guess is someone's gonna have to do some logging and work through the issues on a Windows computer.

gglanzani commented 8 years ago

I'm still getting the error (albeit a bit different) now:

2015/12/30 11:26:37 Uploading to ./test.txt in test.lanzani.nl (873dbaee2e79) [60]
2015/12/30 11:26:39 Uploading to ./af7dda1c28b8/test.html in test.lanzani.nl (8e0047eebd1b) [31556926]
2015/12/30 11:26:39 Copying ./af7dda1c28b8/test.html to ./test.html
panic: Copy Source must mention the source bucket and key: sourcebucket/sourcekey

goroutine 65 [running]:
main.copyFile(0xc08212c4a0, 0xc08212c480, 0x18, 0xc082474170, 0xb, 0x8906e0, 0x9, 0x3c)
./code/go/src/github.com/EagerIO/Stout/src/utils.go:214 +0x345
gglanzani commented 8 years ago

Should be fixed with https://github.com/EagerIO/Stout/pull/14

zackbloom commented 8 years ago

Awesome @gglanzani! Just to confirm, #14 deploys successfully on your machine?

gglanzani commented 8 years ago

Yes!

zackbloom commented 8 years ago

Amazing, thanks @gglanzani!

gglanzani commented 8 years ago

Hi all,

sorry for the extremely late reply. It has been a while since I've updated my website, and while the comments above still hold true, I've find that when I upload folder using Stout on Windows, they end up in

folder\file.html

which is parsed as a file by S3

instead of in

folder/file.html

Is this something that could be easily fixed?

renandincer commented 8 years ago

Tested on Windows Server 2008 SP1 with Stout 1.2.2 and it seems to be working.

proof

What version of Stout were are using? I'd be wonderful if you tried your site with the latest version of Stout or made it available again so that we can make sure your site works.

gglanzani commented 8 years ago

Just tried with 1.2.3, and it indeed seems to be fixed! Thanks!

kauhat commented 7 years ago

Hi folks, sorry to reopen this issue.

This seems to be occurring for me in version 1.3.1. Everything works great under 1.2.3 and 1.3.0.

C:\Users\Jack Fletcher\projects\web\example.com
λ  stout-1.2.3 deploy --config ./deploy.yml --env production
2017/08/09 21:53:52 Uploading to assets/bg-tile.png in example.com (a1bdce3b2994) [60]
2017/08/09 21:53:54 Uploading to 6446fe65ccda/index.html in example.com (336eb0a0c56f) [31556926]
2017/08/09 21:53:54 Copying 6446fe65ccda/index.html to index.html

+------------------------------------+
|         Deploy Successful!         |
|                                    |
|       Deploy ID: 6446fe65ccda      |
+------------------------------------+

C:\Users\Jack Fletcher\projects\web\example.com
λ  stout-1.3.0 deploy --config ./deploy.yml --env production
2017/08/09 21:54:11 Uploading to assets/bg-tile.png in example.com (075ccf3db896) [60]
2017/08/09 21:54:13 Uploading to 6446fe65ccda/index.html in example.com (273191fc5336) [31556926]
2017/08/09 21:54:14 Copying 6446fe65ccda/index.html to index.html

+------------------------------------+
|         Deploy Successful!         |
|                                    |
|       Deploy ID: 6446fe65ccda      |
+------------------------------------+

C:\Users\Jack Fletcher\projects\web\example.com
λ  stout-1.3.1 deploy --config ./deploy.yml --env production
2017/08/09 21:54:31 Uploading to assets\bg-tile.png in example.com (075ccf3db896) [60]
2017/08/09 21:54:34 Uploading to 6446fe65ccda\index.html in example.com (273191fc5336) [31556926]
2017/08/09 21:54:34 Copying 6446fe65ccda/index.html to index.html
panic: The specified key does not exist.

goroutine 38 [running]:
panic(0x6d0480, 0xc04203c360)
        /usr/local/go/src/runtime/panic.go:500 +0x1af
main.copyFile(0xc0420e5ea0, 0xc0420e5e80, 0x17, 0xc04203fe70, 0xa, 0x731375, 0x18, 0x3c)
        /Users/zack/e/stout/src/utils.go:220 +0x2c3
main.deployHTML(0x724b17, 0x1, 0xc04203f644, 0x7, 0x724b75, 0x2, 0xc04203e1a0, 0xc, 0xc04203e1b0, 0xa, ...)
        /Users/zack/e/stout/src/deploy.go:410 +0x5ca
main.Deploy.func1(0xc04203fd10, 0xc042043cc0, 0xc04203fb70, 0xc0420e5680, 0x11, 0xc04203fb60, 0xa, 0x0, 0x0, 0x8c2208, ...)
        /Users/zack/e/stout/src/deploy.go:659 +0xea
created by main.Deploy
        /Users/zack/e/stout/src/deploy.go:660 +0x487

Additionally I've tried building 2.0 from the refactor-for-modularity branch and the backslashes are present in there too:

C:\Users\Jack Fletcher\projects\web\example.com
λ  stout-dev deploy --config ../deploy.yml --env production --fs amazon --dns amazon --cdn amazon --domain example.com --files "*"
2017/08/09 22:39:59 Uploading to assets\bg-tile.png in example.com (075ccf3db896) [60]
2017/08/09 22:40:01 Uploading to 4bad9646c283\index.html in example.com (273191fc5336) [31556926]
2017/08/09 22:40:02 Copying 4bad9646c283/index.html to index.html
panic: NoSuchKey: The specified key does not exist.

Although this could be the configuration on my end as I'm not familiar with v2. I'll let you folks know if I work it out!