OrganizedFellow Posted January 14, 2015 Share Posted January 14, 2015 I've mentioned before that I am now using git and have managed to incorporate it pretty well into my workflow. I need a little help working out the logic on my next matter (this is where you geniuseses come in) So I do my work locally and git push to server. No problem there. But I'm trying to make it simple to separate a LIVE template from a DEV template. For example: I have 'home.php' and 'home.dev.php'. home.php is served on the live website, and home.dev.php is only shown to me, on my local dev station. This is home.php <?php // if server is my local development website, show home.dev.php if($_SERVER['SERVER_NAME'] == 'website.dev'){ include('home.dev.php'); } else { // else show the rest of home.php // PAGE CONTENT } ?> I guess my question is: How do you go about development while also allowing client to view work in progress? I'm looking for something relatively simple like the above. Just wanna see some other ideas. Am I doing it right? yeah yeah yeah, there are a thousand ways to accomplish the same thing in ProcessWire Link to comment Share on other sites More sharing options...
Wanze Posted January 14, 2015 Share Posted January 14, 2015 I would setup a live and test installation. The test installation corresponds to the "dev" branch in GIT, where the development continues. If the client needs to check the current state during development, you can pull on the test server. Once the development is tested and ready to go live, I merge into the master branch and pull on the live server. 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 14, 2015 Share Posted January 14, 2015 As wanze said, just use different git branches so keep track of different development stages. 1 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted January 15, 2015 Author Share Posted January 15, 2015 I would setup a live and test installation. The test installation corresponds to the "dev" branch in GIT, where the development continues. If the client needs to check the current state during development, you can pull on the test server. Once the development is tested and ready to go live, I merge into the master branch and pull on the live server. You mean a live and test installation APART from my localhost development installation? I just started reading about this. So ... correct me please if I have this incorrect: I am using NearlyFreeSpeech as the host for this project. I followed this tutorial to get git set up: http://andytaylor.me/2012/11/03/nfs-git/ So I would have my localhost git repo with two branches, let's say *git branch master (which I think would be live, right?) and *git branch development (which would be the work in progress). Can each push to a different directory? [ ... thinking aloud here ... ] So the tutorials say to git remote add live ssh://USERNAME@111.222.333.444/home/public/.gitSo when I commit and push, I rungit push live master So I COULD (i think) do this? git remote add test ssh://USERNAME@111.222.333.444/home/public/test.git and commit like: git push test development Link to comment Share on other sites More sharing options...
OrganizedFellow Posted January 15, 2015 Author Share Posted January 15, 2015 Does that mean I would have ProcessWire installed in two directories? live = fabulouswebsite.com/ test = fabulouswebsite.com/test/ ? Link to comment Share on other sites More sharing options...
n0sleeves Posted January 15, 2015 Share Posted January 15, 2015 What I do is setup a password protected subdomain on my website for the site version I want them to see. If they need to see what I'm working on (the development "Work In Progress" version) , I push my localhost live via a tunnel and send them the link. As long as the tunnel is open they can see my localhost. I am using Ngrok but there are countless others. Just Google, "localhost tunneling". It definitely made my workflow easier 2 Link to comment Share on other sites More sharing options...
cstevensjr Posted January 15, 2015 Share Posted January 15, 2015 My setup is very different. I do all my web development work online using Dedicated servers. I create a development domain environment for each client and they have access to review the website work as it's being done. This works great for me since the transition from development to production is minimal. I brief each client on an at least weekly basis (online meeting, via phone or in-person) on the topics that are important to them. Each of my clients has 24 hour access to a customized project management website (Processwire based & still under constant development: i.e. alpha status). I make use of the client project website, Evernote (shared notebooks) and Dropbox (shared folders) to maintain all client related work and documentation. I work to ensure that the 3 systems stay linked together in a cohesive manner. A majority of my clients are not associated with any web development work, however I make sure they are familiar with ProcessWire through the client project websites. They get to see and work with the front-end/back-end (Admin) sides of ProcessWire on a constant basis. 6 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted January 15, 2015 Share Posted January 15, 2015 I think this recent post can be helpful here. 2 Link to comment Share on other sites More sharing options...
Wanze Posted January 15, 2015 Share Posted January 15, 2015 You mean a live and test installation APART from my localhost development installation? I just started reading about this. So ... correct me please if I have this incorrect: I am using NearlyFreeSpeech as the host for this project. I followed this tutorial to get git set up: http://andytaylor.me/2012/11/03/nfs-git/ So I would have my localhost git repo with two branches, let's say *git branch master (which I think would be live, right?) and *git branch development (which would be the work in progress). Can each push to a different directory? [ ... thinking aloud here ... ] So the tutorials say to git remote add live ssh://USERNAME@111.222.333.444/home/public/.gitSo when I commit and push, I run git push live master So I COULD (i think) do this? git remote add test ssh://USERNAME@111.222.333.444/home/public/test.git and commit like: git push test development Almost You need only one remote repository where the code lives, but with two branches. It's the same git model as ProcessWire uses: The master branch contains the latest stable code, whereas the dev branch contains all the new features. Live Website (e.g. www.yourdomain.com): - master branch is checked out, to get new commits from origin: git pull origin master Test Website (e.g. dev.yourdomain.com): - dev branch is checked out, to fetch the new commits: git pull origin dev Does that mean I would have ProcessWire installed in two directories? live = fabulouswebsite.com/ test = fabulouswebsite.com/test/ Yep, but totally separated, not the dev version inside a sub folder. Also separate databases. 6 Link to comment Share on other sites More sharing options...
owzim Posted January 15, 2015 Share Posted January 15, 2015 @n0sleeves have to look into the tunneling thing, sounds great. I set up a PW installation on the server, and push my local templates folder changes via git ftp (also supports FTPS (FTP over SSL)), which really only pushes the changes, tracked by git. Good thing is, this workflow also works if the client's server does not have git available, only good ol' ftp. AND you still can profit from branching locally. 2 Link to comment Share on other sites More sharing options...
marcus Posted January 15, 2015 Share Posted January 15, 2015 @n0sleeves have to look into the tunneling thing, sounds great. My recommendation: http://usefinch.com. Using it primarily for checking local virtual hosts on devices and inside Parallel VMs (with own hostname and no subfolders) but should be suitable for n0sleeves' use case as well. 3 Link to comment Share on other sites More sharing options...
owzim Posted January 15, 2015 Share Posted January 15, 2015 @marcus, I recall Jeffrey Way talking about this, I was amazed but totally forgot about that, thanks. 1 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted January 15, 2015 Author Share Posted January 15, 2015 What I do is setup a password protected subdomain on my website for the site version I want them to see. If they need to see what I'm working on (the development "Work In Progress" version) , I push my localhost live via a tunnel and send them the link. As long as the tunnel is open they can see my localhost. I am using Ngrok but there are countless others. Just Google, "localhost tunneling". It definitely made my workflow easier The password protected domain part sounds REALLY interesting! I have terribly slow (under 2Mb/s internet speed) so I am gonna guess that the tunneling would kill my internet speed. We can't even have two devices on YouTube at the same time, lol. I think this recent post can be helpful here. haha, yup, I just saw that this morning. Another great way! Almost You need only one remote repository where the code lives, but with two branches. It's the same git model as ProcessWire uses: The master branch contains the latest stable code, whereas the dev branch contains all the new features. Live Website (e.g. www.yourdomain.com): - master branch is checked out, to get new commits from origin: git pull origin master Test Website (e.g. dev.yourdomain.com): - dev branch is checked out, to fetch the new commits: git pull origin dev Yep, but totally separated, not the dev version inside a sub folder. Also separate databases. This makes the most sense to me and it's a good way to learn s'more GIT, lol. Thank you!!! 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 15, 2015 Share Posted January 15, 2015 The only annoying thing about git branches is managing the database, especially in the early stages, where content may not be present from the beginning. But everything else is super easy. You could even use webhooks (github and gitlab) to call a php file on your server, which than pulls changes after each push from your local machine to the remote repo. 1 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted January 16, 2015 Author Share Posted January 16, 2015 The only annoying thing about git branches is managing the database, especially in the early stages, where content may not be present from the beginning. But everything else is super easy. You could even use webhooks (github and gitlab) to call a php file on your server, which than pulls changes after each push from your local machine to the remote repo. On my local dev machine, I learned to edit the .git/hooks/pre-commit file to execute a mysql dump and save dump.sql which I then import (currently manually) into my live site using Adminer. 1 Link to comment Share on other sites More sharing options...
n0sleeves Posted January 16, 2015 Share Posted January 16, 2015 My recommendation: http://usefinch.com. Using it primarily for checking local virtual hosts on devices and inside Parallel VMs (with own hostname and no subfolders) but should be suitable for n0sleeves' use case as well. I've seen usefinch.com before. However, they limit you to only 2 hours of usage per month. Ngrok is free unlimited (pay what you want) and also has subdomain, password protection, etc. ability. Another tunneling service I was quite found of is https://forwardhq.com/. Their minimum pay plan is only $5 a month and what sets them apart is the ability to have a custom page your clients see when the tunnel is offline. The password protected domain part sounds REALLY interesting! I have terribly slow (under 2Mb/s internet speed) so I am gonna guess that the tunneling would kill my internet speed. We can't even have two devices on YouTube at the same time, lol. Wow. That's some terrible speed However, I wouldn't think it would affect you since the only time it sends data is when being accessed. You could have it tunnel all day long without any data being sent. It only sends when the client accesses. 1 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted January 17, 2015 Author Share Posted January 17, 2015 Wow. That's some terrible speed However, I wouldn't think it would affect you since the only time it sends data is when being accessed. You could have it tunnel all day long without any data being sent. It only sends when the client accesses. Sadly we live in an "under developed area" for AT&T DSL. Time Warner cable offers a high speed service, but for $70 per month. We can not justify that cost yet. Link to comment Share on other sites More sharing options...
yellowled Posted January 20, 2015 Share Posted January 20, 2015 Might not be as comfortable as similar solutions mentioned here (the generated subdomain URLs are pretty long and clumsy to type on mobile devices), but http://localtunnel.me is another node.js thingy to forward your local dev server. 2 Link to comment Share on other sites More sharing options...
owzim Posted January 21, 2015 Share Posted January 21, 2015 @n0sleeves just tried ngrok, that's even 4w3s0m3r thanks I like pay what you want services, because in my experience, they almost always have great support (they are kind and not of the greedy type), and I end up paying more that for other services without that model. We have a great pwyw hoster here in Germany, uberspace, they rule! 1 Link to comment Share on other sites More sharing options...
diogo Posted January 28, 2015 Share Posted January 28, 2015 Might not be as comfortable as similar solutions mentioned here (the generated subdomain URLs are pretty long and clumsy to type on mobile devices), but http://localtunnel.me is another node.js thingy to forward your local dev server. I knew ngrok, but not this one. @yellowled try this: lt --port 80 --subdomain notclumsy 1 Link to comment Share on other sites More sharing options...
yellowled Posted January 28, 2015 Share Posted January 28, 2015 @yellowled try this: Thanks, I actually found that option myself in the meantime. Also nice for the grunt folks among you: there's a grunt task to start localtunnel. Link to comment Share on other sites More sharing options...
Recommended Posts