craft-scripts icon indicating copy to clipboard operation
craft-scripts copied to clipboard

Add an asset solution for Windows users

Open furioursus opened this issue 6 years ago • 16 comments

So this is obviously not something that affects many people, I know most of us are on Macs, but one thing I came across is that Rsync does not exist for Windows users. There are a few options out there for us to use, but many of them don't have support for all the flags your script in ./pull_assets.sh uses.

It's not an urgent issue at all, but if anyone has a solution for getting around this requirement, it'd be rad. It's the only stumbling block I have in getting this environment up and running in a near 1:1 setup with my Macs.

furioursus avatar Oct 12 '17 23:10 furioursus

Yeah I'm really not sure what to do here. I just don't use Windows on a regular basis, so I don't have a test environment.

I'd very happily accept pull requests for ensuring that Craft-Scripts works on Windows as well, though!

khalwat avatar Oct 20 '17 00:10 khalwat

Yeah, I didn’t think you’d have one. Just hoping some Windows user who tries to use it takes this on. ;)

furioursus avatar Oct 20 '17 17:10 furioursus

Hola! I'm actually about to start work on porting these for Windows. I'm a full time student so it may take some time, but I'll do a PR as soon as I'm done :)

alexstojda avatar Feb 12 '18 17:02 alexstojda

Ah very cool @alexstojda !

khalwat avatar Feb 12 '18 17:02 khalwat

@alexstojda Have you made any progress on this? I'd be interested in working on it with you - I'm a Windows user too and I'd really like to use these scripts. 😄

KatieMFritz avatar Mar 29 '18 21:03 KatieMFritz

Not yet! Looks like it's going to be a summer project to be honest. School has taken most of my time sadly.


From: Katie Fritz [email protected] Sent: Thursday, March 29, 2018 5:13:39 PM To: nystudio107/craft-scripts Cc: Alex; Mention Subject: Re: [nystudio107/craft-scripts] Add an asset solution for Windows users (#22)

@alexstojdahttps://github.com/alexstojda Have you made any progress on this? I'd be interested in working on it with you - I'm a Windows user too and I'd really like to use these scripts. 😄

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/nystudio107/craft-scripts/issues/22#issuecomment-377374367, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABSn9HNB7fdwIlW7Mddpg_tEnUCx0sGfks5tjU6DgaJpZM4P3wje.

alexstojda avatar Mar 30 '18 00:03 alexstojda

@alexstojda I got things working using cygwin. I'll try to write something up eventually, but in the meantime, let me know if you want any troubleshooting help.

KatieMFritz avatar Apr 12 '18 19:04 KatieMFritz

@KatieMFritz I'd love to hear the pertinent details of what you had to do to get it working. It's either that or I might just end up going back to Laravel/Homestead for my pc boxes.

furioursus avatar Apr 12 '18 20:04 furioursus

@onebrightlight Oh boy. 😆 Okay, here's what I did, minus the going in circles:

  1. Find out cygwin exists.

  2. Install the latest version of cygwin. I followed this tutorial. Be sure to install bash, cygrunsrv, nano, openssh, and rsync packages. Don't install all the packages or it will take forever.

  3. Follow these instructions for setting up publickey auth via cygwin/openssh, or prepare to enter your password every time you want to do anything on the remote server.

    • I used nano to open/edit files.
    • Some of the settings in etc/sshd_config didn't look the same, so I just gave it my best guess.
    • Name your RSA keys the default id_rsa; that caused me a lot of trouble when I didn't.
    • I already had an .ssh/authorized_keys file on my remote server (DigitalOcean/ServerPilot), so I just added my new key on a new line.
  4. Download the repo and copy over the scripts folder into project root directory.

  5. Configure .env.sh per the instructions. Follow the instructions very carefully! 😅

    • Be careful to use absolute paths (when specified) and always end with a trailing /.
    • For Craft 3, I'm pretty sure GLOBAL_CRAFT_PATH needs to be "". (psst @khalwat )
    • Rsync won't work if you have a colon in your local path, so use your cygdrive path instead. Copy it from your cygwin terminal. My project root is /cygdrive/c/wamp64/www/safs-effs/.
    • Use absolute path for LOCAL_BACKUPS_PATH (mine is C:/wamp64/www/safs-effs/storage/backups/)
    • You may need to run your local mysql commands from an absolute path. This is what I used:
      LOCAL_MYSQL_CMD="C:/wamp64/bin/mysql/mysql5.7.19/bin/mysql"
      LOCAL_MYSQLDUMP_CMD="C:/wamp64/bin/mysql/mysql5.7.19/bin/mysqldump"
      
  6. Feel like a wizard, but also wish you had a MacBook so you didn't have to become a wizard.

To run scripts:

  1. Open a cygwin terminal to the project root (I use the VSCode Shell Launcher extension).
  2. Run your script by typing its relative path, like scripts/pull_db.sh.
  3. Troubleshoot by adding more cygwin packages (you have to run the setup again each time), Googling, and invoking the devops gods.

KatieMFritz avatar Apr 12 '18 23:04 KatieMFritz

@KatieMFritz you are a genius! I knew about Cygwin but completely forgot about it

alexstojda avatar Apr 25 '18 20:04 alexstojda

@khalwat I think this is an acceptable enough solution to include in the readme and close the issue!

alexstojda avatar Apr 25 '18 20:04 alexstojda

@KatieMFritz while "" will probably work, the default setting should work as well:

GLOBAL_CRAFT_PATH="./"

Do you mind if I steal your writeup and add it to the docs?

khalwat avatar Apr 25 '18 20:04 khalwat

@khalwat Do it!

KatieMFritz avatar Apr 25 '18 23:04 KatieMFritz

PS - when uploading .env.sh to the server, be sure to convert to Unix style line endings. 😬

KatieMFritz avatar Apr 29 '18 15:04 KatieMFritz

FYI, you don't need to use Cygwin if you're on Windows 10; Windows 10 has the Windows Subsystem for Linux (aka WSL) which allows native use of Linux shells via a container. The whole thing is pretty seamless. I'll write some docs.

adrienne avatar Apr 12 '19 19:04 adrienne

PR me @adrienne !

khalwat avatar Apr 14 '19 03:04 khalwat