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

Add an asset solution for Windows users #22

Open
furioursus opened this issue Oct 12, 2017 · 16 comments
Open

Add an asset solution for Windows users #22

furioursus opened this issue Oct 12, 2017 · 16 comments

Comments

@furioursus
Copy link

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 furioursus changed the title Add a backup solution for Windows users Add an asset solution for Windows users Oct 12, 2017
@khalwat
Copy link
Contributor

khalwat commented Oct 20, 2017

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!

@furioursus
Copy link
Author

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

@alexstojda
Copy link

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 :)

@khalwat
Copy link
Contributor

khalwat commented Feb 12, 2018

Ah very cool @alexstojda !

@KatieMFritz
Copy link

@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. 😄

@alexstojda
Copy link

alexstojda commented Mar 30, 2018 via email

@KatieMFritz
Copy link

@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.

@furioursus
Copy link
Author

@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.

@KatieMFritz
Copy link

KatieMFritz commented Apr 12, 2018

@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.

@alexstojda
Copy link

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

@alexstojda
Copy link

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

@khalwat
Copy link
Contributor

khalwat commented Apr 25, 2018

@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?

@KatieMFritz
Copy link

@khalwat Do it!

@KatieMFritz
Copy link

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

@adrienne
Copy link

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.

@khalwat
Copy link
Contributor

khalwat commented Apr 14, 2019

PR me @adrienne !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants