I have been reading about this and tried to set it up repeatedly, but failed.
What I want:
Work on my site, edit, and when i think it’s ready, open it to the world - so that visitors won’t catch me in the middle of editing.
I believe this is a common concept, and what I want is called seperate development and production environments.
According to this all I need to do is to move any part of my
user folder to a new subfolder, e.g. like this:
mv user/pages user/my.domain.com/pages.(1)
However this does not work, after clearing the cache I navigate to my.domain.com and get this:
Please Review and Resolve before continuing…
(in red) /home/me/path/user/pages does not exist
(the rest is green)…
- am i going about this the right way?
- what is the correct name for the subfolder? apache2/sites-enabled config? but that one just specifies the port, my router then opens that port to the world.
(1) ultimately I would like to have 2 completely seperate e nvironments, one only accessible through my local network, for development, and when i’m done developing just copy it over the current open-to-the-world environment (maybe there’s even a magical command for that).
I’m afraid I can’t help with the multisite stuff. Maybe someone else can chime in. Grav is completely self-contained. It is trivial to have multiple installs side by side. I have a complete install on my main domain and another in a
/dev folder. I do my work there and then copy/rsync changes to the live server. You can do the same thing with a local server if you want, but I move around too much. Everything needs to be remote. Multiple installs is the simplest approach.
If I understand correctly, then the Automatic Environment Configuration to which you gave a link is not for having multiple copies of your site. It’s for defining different config settings depening on where your site is located.
The examples there basically suggests this:
If your site is reached via localhost, then activate the debugger. If you copied the whole site to your server and reached it via www.yoursite.com, then not. Instead other options are applied.
If you want to have mulitple copies, then do how Perlkönig suggests, which is really easy.
Thanks for both your replies.
I have meanwhile set up 2 seperate copies of the site, development under a non-standard port. That works well enough for me. It’s not perfect because most media files are also duplicated, but short of moving them to a different location (which can be accessed by both environments) I don’t see how I could do anything about that.
And you already answered my question whether I can use rsync to update the main site.
BTW, there’s some mention of multisite features here, but it seems just a little unstable. Maybe later.
How about a different approach.
- develop on one machine, be it local or another staging server.
- put your
/user folder into source control so that you can easily sync it with your live/production site
- use environment config (e.g.
user/localhost/config/...) to configure local specific settings for system, site, plugin, theme config etc.
- make changes local, push changes to source control system when ready.
- use pothook of source control to push changes automatically to your production server.
This is how we do all our sites, I even outlined this in a general way in his older blog post: https://getgrav.org/blog/developing-with-github-part-1
thanks for the precious hints.
I created a git repository from my development site, but did not push it to github because I don’t want it public.
instead i’m cloning it locally to a staging and ultimately production version, and pulling locally (i don’t know what pothook is - something github specific maybe?).
could you do me a favor and look over the
.gitignore in this article, is it still up-to-date after 2 years?
I think he meant webhook, not pothook, as I never heard of that
GitHub / Bitbucket all provide in their panels a way to notify a script that a push has been sent, you can then trigger a “pull” on your server.
The ‘Developing with github’ articles are very helpful and works great for Github. However, when working with private repos on bitbucket, I can’t make the webhook to work. It looks like bitbucket had an update and now send a JSON with data.
A section explaining how to achieve the same thing on a bitbucket private repo would be great!