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
Related
I have a client who wants me to update their Drupal site. I've never done this before, and I want to work on it from my local machine just in case something goes wrong. I have no idea where to even start!
First off, how do I access my client's site files so I can get them onto my computer? I've tried entering the information the client gave me into Cyberduck, but it won't give me access. Is there another way to get access?
Also, how do I host it locally? I have XAMPP, but I'm not sure how to use it.
That being said, I have found a few forums that should help me set up the local server. I just don't know how to get the files from the live server to my computer.
I know this is a super noob problem, but I could use the help. Thank you!
Well, for the basic question, you have to get the correct credentials from your client. There's no alternative, really :D
While you're at it, you'll want a copy of the site's database too.
For the question "how do I host it locally?" Here's how I would go about it.
Get the site into version control.
Given that you were given (S)FTP credentials, I'm guessing the site is not version-controlled. If that's correct, then that is probably the very first thing you want to do. This will allow you to keep track of the changes you've made on your local site that are different to the production version.
Create an empty directory on your computer.
Navigate to the directory in a terminal and run git init.
Add a .gitignore file to that folder (you can create your own, or use one customized for Drupal).
Download the site's files into the directory created in step 1.
Add the files from the in the directory to the git repository by running this command in a terminal: git commit -am "First commit of Drupal files to repository."
There's a good help page about working with Drupal in git on drupal.org.
Create and populate your database.
Get a database dump from the live site.
Create a new database and database user on your machine.
Import the database dump into your new database.
Record the database credentials in settings.php or settings.local.php and store them somewhere safe, preferably in a password manager.
Change the database credentials in settings.php or settings.local.php to match the credentials of the database you've just created.
(For safety and to avoid confusion, I always create local databases with a different name, user, and password than the live site has. This means if your local credentials are compromised, the live site isn't, and it means you can't connect to and change the live site's database by accident.)
Set up the webserver in XAMPP
Create a new site in XAMPP called e.g. example.local that points to the directory that contains the file index.php
Add the following line the file called /etc/hosts on your computer:
127.0.0.1 example.local
Test that this works in a browser by visiting e.g. http://example.local or http://example.local/robots.txt.
Move your local changes to the Production site
How you will be able to do this depends to some extent on your client's web-hosting infrastructure, and what version of Drupal your client uses. but in any case, you will have three separate concerns for changes you make:
Code changes
You will need to deploy changes you make to the code back to the server. Ideally you would probably do this via Git either by cloning directly into the live site or (far better!) as part of an automated build process. By the sound of it, you may just have to FTP the changes back up.
Be careful not to re-upload your modified settings.php or settings.local.php file!
Content changes
You probably have to test some/all of your content changes locally and then recreate them on the live site. Because your client may have made changes to the live site while you were working, you can't risk importing your local database into the live site.
Configuration changes
Changes to configuration should be managed in code (i.e. as part of 1. Code changes above) if that's possible. In Drupal 7, the Features module is usually the best way to accomplish this (here's an answer I wrote describing the Features workflow). Drupal 8 has the Configuration Manager. Be aware that these two tools can both be tricky to use well.
Your client needs to gave you access to the files so you can put them into htdocs on XAMPP, then you need the database (also provide by the client), start XAMPP, create a new database on localhost/phpMyAdmin and import the db of the site. On the proyect code go to sites/default/settings and change the db settings to your local settings. Then you can go to localhost/{your-proyect} and it should work.
I have a website in my own localhost using Wamp coded using php.
I recently joined Google Cloud Platform and have deployed Lamp Stack in it.
I also setup the MySQL database in it successfully.
But now I am confused on how to upload my files into that.
The OS is Debian 8
I have been using BitBucket for some time, is there a way that I can clone the data from there directly to google cloud?
Can anyone guide me how to upload the PHP files in there so that I can test my website?
Is there any GUI for that rather than command line? I am not that good with command line.
P.S. Ready to give any more relevant info, as I don't know what all data from my side is required to answer this.
When deploying google Lamp stack(click to deploy) you will automatically be creating an instance of Google Compute Engine - check Compute Engine / VM Instances menu.
Method 1:
Click on SSH button next to the instance name and a new terminal window will open. Make sure you have git installed, if not install it yourself
sudo apt-get install git
Locate your html apache/linux folder. Usually it's
cd /var/www/html
Then download your repository with
git clone https://www.path.to.repository.git
Make sure you use the https repository url not the ssh one. For SSH you will need to have the same SSH key on your instance as on your bitbucket account. With https you will be able to log on with your normal credentials.
Method 2:
You can upload files with SFTP.
First you need to generate a key with PuttyGen if you don't have one already.
Next go to the GCP menu, click on the Compute Engine menu then on the VM instances submenu.
Check the lamp instance then click Edit to go to the Edit page. Scroll down till you find the SSH keys textbox. Paste in the contents of your key.
Next use any SFTP client. You can do that from within PHP Storm, FileZilla or Putty by selecting your private key and connecting to yourusername#instance_external_ip
Good luck php wizz
I have a Laravel application. It's live and have daily users. I need to update some features. Not only front end work. Have to change back end too. With database. The problem is our old developer created this site. Now he's not here, and also no any documentation or blue print available. I downloaded the project. I can change front end even it's live. Changes affected. Is there any way to change some back end and database when it's live ? Is that a risk ?
Please guys don't give minus points to this question.
You should be creating a development environment on your local machine, with it's own database etc. Change that, test it, and once you are happy, upload your file and schema changes.
For setting up a quick dev environment that closely matches your production server, download VirtualBox and Vagrant. Then visit http://puphpet.com, which will allow you to generate a server config.
Unzip the config, cd into the folder, and type vagrant up. Your server is now on 192.168.56.101.
Lastly, edit your OS hosts file to point your.dev.site.com to that ip. (the default domain name in puphpet is awesome.dev
You can get inside the VM by typing vagrant ssh if you need to.
Don't edit a production site, especially with live users!
I've created simple webapp + mysql database on azure and i've set ftp username/pass. I'm following this article:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-php-mysql-deploy-use-ftp/
Everything is fine up to the ftp part, i just can't connect to that ftp. I tried using the username/pass i set in Deployment Credentials. I tried using the username/pass i see in the PublishSettings file, but nothing is working.
I tried via linux ftp cmd and filezila and played with active/passive.
When i telnet ip 21 i'm getting timeout too.
Could someone please explain how to connect to that azure ftp?
Thanks
One common problem is that you need to have the username look like YourSiteName\YourUserName and not just YourUserName.
If you look under 'FTP/Deployment username' in the Azure portal, it gives the correct name with the site name prefix.
According to the offical documents, the section Deploy by copying files to Azure manually of the doc Deploy your app to Azure App Service introduce the steps of deploying the WebApp via FTP.
The key point of deploying via FTP on Azure is the FTP connection information, you can follow the steps 5 to 7 of the section Get MySQL and FTP connection information of the doc Create a PHP-MySQL web app in Azure App Service and deploy using FTP to find them from the .publishsettings file got on the Azure new portal, please see the picture below.
The method shown in the tutorial you link to is how I do it when I need to lookup my azure credentials - by downloading the Publish Profile and pulling the information out of there.
Here's how I do it:
using FileZilla (https://filezilla-project.org/) I plug the publishurl in the host field, leave the port blank, select FTP - File Transfer Protocol, use explicit FTP over TLS if available, Logon Type: Normal, enter userName in the user field, userPWD in the password field.
Click Connect and the FTP connection is made (after I click the security msg).
So it's a plain old FTP connection. There's nothing special going on.
If this isn't working for you I would suggest the problem isn't with your credentials, check the webapp has been started in azure, check you can ftp with another site\server.
Good luck. Hope this helps.
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