craft-scripts
craft-scripts copied to clipboard
Add an asset solution for Windows users
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.
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!
Yeah, I didn’t think you’d have one. Just hoping some Windows user who tries to use it takes this on. ;)
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 :)
Ah very cool @alexstojda !
@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. 😄
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 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 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.
@onebrightlight Oh boy. 😆 Okay, here's what I did, minus the going in circles:
-
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.
-
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.
-
Download the repo and copy over the
scripts
folder into project root directory. -
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 isC:/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"
- Be careful to use absolute paths (when specified) and always end with a trailing
-
Feel like a wizard, but also wish you had a MacBook so you didn't have to become a wizard.
To run scripts:
- Open a cygwin terminal to the project root (I use the VSCode Shell Launcher extension).
- Run your script by typing its relative path, like
scripts/pull_db.sh
. - Troubleshoot by adding more cygwin packages (you have to run the setup again each time), Googling, and invoking the devops gods.
@KatieMFritz you are a genius! I knew about Cygwin but completely forgot about it
@khalwat I think this is an acceptable enough solution to include in the readme and close the issue!
@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 Do it!
PS - when uploading .env.sh
to the server, be sure to convert to Unix style line endings. 😬
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.
PR me @adrienne !