Can I Link XAMPP Server to Github? - php

How would I go about starting a XAMPP server that uses files from GitHub instead of htdocs?
The idea is that I have my PC on connected to my router and while I am away I can push or merge updates to GitHub, and they are automatically live as XAMPP would be pointed at my Repo.
Can this be done?
I know you can use gitpages, but php and server side code is critical to what we are doing.

You could use webhooks in combination with your Xamp server in order to:
listen to push events on GitHub, and,
when said push is detected, git pull that repository in order to update your files

Related

How can i to deploy my PWA on remote server?

I developed a Progressive Web App (PHP and JavaScript based) and i upload it on remote server LEMP (Debian/Nginx based) through FileZilla.
How can i deploy in future the updates without to use FTP?
What tools exists for to manager the next versions of my web app?
If it is of utility i use VSCode for coding.
Thanks guys!
You can't update your web app without FTP. In order to update a new service worker, it needs to have at least one byte different than the previous version.
And the only way to update the service worker file is via FTP.
If you can't use FileZilla for whatever reason, you can try alternatives like editing files through Cpanel File Editor.
Or you can use free hosting like Github Pages, Netlify or Firebase. And automate the deployment of your front each time you commit something on a git repository.
This solution only works for your static files. not for your backend using PHP.
Thanks guys for your replies.
I found the right solution for me following this article: https://amifactory.team/blog/how-to-deploy-a-website/#simplewayscprsyncftp
In pratice i use lftp utility to sync my local website with my website on remote server.
The good notice is that "lftp" copy changed files only, reducing the uploading time and copying / overwriting the new files only at the end of the "lftp" process.

How to perform a self-update on a local web system?

I developed a web system (in CodeIgniter) for a client and it runs on a local machine inside his office. Whenever I need to update the system, I perform the following steps:
Access to server machine via TeamViewer;
I open CMDER;
Access my account on Bitbucket to give a git pull;
I run the necessary migrations;
Thinking about these desktop systems that automatically look for a new version and upgrade, is it possible to do a routine in this web system to do the same thing? Search Bitbucket (or another web server) for a new version and then do the update?
Thanks for the suggestions.

automatic pull on production server after push to BitBucket

I develop my code locally, commit it to my local repsoitory and then push it to my Bitbucket server. After that I have to login via ssh to my production server
like this:
ssh my-server#my-host.de
pass: very-secure-passs
cd www/myPage
cd git pull origin master
pass: very-secure-pass
I would like to avoid login to my production server and let him pull automatically.
I want to have 3 repositories (local, BitBucket and production Server), so I cant use this solution: Do an automatic pull request after pushing to server
I found this question A hook that let `pull` from VPS when I `push` to Bitbucket which is exactly what I want, but it is from 2013 and the answer is outdated since BitBucket has changed since then.
I found here https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-I-deploy-my-bitbucket-repo-to-my-production-server/qaq-p/565348 that someone suggested to use a free Plugin called HTTP-Request Hook for Bitbucket Server
set up an automated "Pull": Each time you do a push to your central
repository, your production machine is notified and pulls the
repository on notification. Bitbucket Server offers serval plugins to
support the notification process - the one I use is Http Request Post
Receive Hook: each time a push is made, a configured URL is contacted,
submitting some info. On my production machine I have set up a little
web server, waiting for this HTTP-Request. On receiving the
HTPP-Request I evaluate the given parameters and perform an action
(for example: pulling the repository ...)
Now my questions are:
Is it possible to use a Webhook instead of the HTTP-Request
Hook Plugin?
How should the file on my production server look like so that it will do a pull request when it receives a HTTP-Request? I would be interested in a basic example in PHP.
The webhook documentation you linked is for Bitbucket Cloud (bitbucket.org), not Bitbucket Server (which is self-hosted and has some other URL). If you're using BB Cloud, then the HTTP-Request Hook Plugin won't work, but the documentation you linked will. If you're using BB Server, then you can use https://confluence.atlassian.com/bitbucketserver/managing-webhooks-in-bitbucket-server-938025878.html instead to define a webhook.
For the second half of your question - how to set up your server's end of a webhook - you'll need to have a small service that listens for the incoming webhook, does whatever authentication you want, and then runs your pull method. There are a zillion ways to do this, but most will vary based on your preferred language and security settings and on the network configuration of the server in question. I'd suggest a Google search for "webhook deploy $LANGUAGE" to see how some others have done it with your preferred language, or to see if there's a public repo or gist or snippet out there that you can use.
Instead of directly trying to pull on production server, you can setup a Jenkins job that will push the code to production server on each commit. Using Jenkins you can even customize the solutions to match particular token in commit message.

Git autodeploy on Windows 2003 with WAMP

I work for a company that for some reason uses a Windows 2003 server with WAMP for its live product (please don't ask me why). Currently we have to push updates locally to github, manually connect to this production server with Remote Desktop Connection and pull.
We want to automate this proccess.
I have tried github webhooks with no success -> Couldn't find a way to create SSH keys for the system account (NT AUTHORITY/SYSTEM), which is the one used by apache on that server solution. The project is currently cloned via HTTPS, so we could also try saving credentials globally so that git won't prompt the local system account for password when trying to pull via PHP, but that seems like the worst possible solution security-wise.
Any ideas?
-- UPDATE --
We've decided not to worry about security implications right now. I then followed all the steps to save credentials for a new read-only user, but no success. I can see a .git-credentials file with the correct user/pass/url in:
C:\WINDOWS\system32\config\systemprofile
All commands work (via browser) except for pull, fetch, etc.
Any more ideas?
-- UPDATE 2 --
I've now changed the wampapache service to run as an administrator account instead, which also has credentials stored on its "root" folder (~). It's the same account I can push/pull via cmd without user/pass prompts. But when I try via browser... No luck.
I'm now officially out of ideas.
I have finally found a solution!
Simply editting the git config file to add user:password to the url parameter under [remote "origin"] has done the job.
url = https://user:pass#github.com/organization/project.git

Git setup for web development on my personal server

I'm going to start working on a web application. The application uses php and the files are going to be hosted on a server I own. Some of my friends will also be working on this project with me.
How exactly should I set up git (using GitHub) so that when me and my friends push our changes to GitHub, our server gets updated automatically with the php files?
git push has a mirror mode that may just be what you want. All you need to do to activate it is to set your remote as --mirror=push and all should be good. IF not, leave a comment and I'll help further.
Another way is to install git on your server, add the settings for github and setup a cron every x period (1 minute) that makes a git fetch and reset to the development branch - that way when you push something to that branch your server will fetch it and reset the filesystem to it.
3rd way - check out the article using Github WebHooks on http://jonathanstark.com/blog/deploying-code-automatically-with-github-webhooks

Categories