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
Related
I want to run a web application on a Windows computer but because of some reasons, I don't want to install a web stack like Xampp on that machine.
The web app is placed in a folder and inside of it, there are Apache, PHP, the database like MySQL or PostgreSQL, and the web source. If we want to access it, there is just a shortcut in the Desktop, and when we click that, the browser is opened and point to an URL with a particular port like localhost:8888. And the web app is opened.
I just want to put that folder in an installer. And the installer just extracts it to system folder and create a shortcut on the desktop.
I ask this because I have ever seen stuff like this. It used PostgreSQL. Simply like what I've just explained above.
If you know how to make it works, you may want to help me. Your answers will be appreciated.
You have three way to provide your web application as a software application
you can create portable server in pen drive server start by your application present on desktop icon.
you can create installer using Microsoft Installer which install all the requirement in one go then point ini file to your source code folder. This will let desktop icon to start xammp and run your application.(only applicable for window)
write python script to install web server using CMD and Terminal. then python script point ini to your source folder . Generate shortcut for server start command and launch browser with url.
we already provide Lab application in pen drive based server
I'm an AWS newbie and I can't seem to find a good example. There are plenty of static website examples for S3, but my site needs to run a fairly simple PHP script which then means I need to be on EC2.
I used Elastic Beanstalk to create an EC2 instance and it added a simple PHP example, so when I go to the public DNS address in a browser, I see the example PHP script run. So far, so good.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
So, how do I upload an html website to run on this instance and still get a PHP script to run?
Sorry if I have some of the terminology or methodology wrong.
Thank you.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
They probably are but in a ZIP package. You don't modify anything on the fly. You're supposed to modify your source code on a local machine, "bundle" it in a ZIP file and then either
Upload with AWS Console.
Upload it to S3, create an application version with AWS CLI and then deploy (also with AWS CLI).
Docs are here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_eb.html
It is possible to change your application by connecting to an EC2 instance, but your changes will be lost during redeployment, scaling etc.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
When you created your Elastic Beanstalk environment you were asked for 'EC2 key pair'. You should use that exact SSH key to connect to your instance. This step is optional, so it is possible that you skipped it and created an environment without a key. In this case there is no way to connect to your EC2 instance (almost). You'll have to upload an SSH key (EC2 dashboard -> NETWORK & SECURITY -> Key Pairs) and create a new environment.
I have developed a PHP site in Eclipse on localhost and have just transferred it to a GCP Compute Engine instance. To do this I've had to upload the site to a Storage Bucket and then on the SSH Shell for the instance in GCP used gsutil to transfer the files.
Now, as far as editting goes, is there a way for me to connect eclipse to the GCP instance and edit via Eclipse?
I don't want to have to, for every tweak, upload to the storage bucket and then copy file across to the instance. This would be most tedious.
I have created a firewall rule on the network to allow all traffic from my public IP to the Compute Engine instance (until I can lock it down once I've got the connection)
Thanks
This article describes a procedure to editing remote files in Eclipse:
http://www.chrisdanford.com/blog/2010/05/19/edit-files-directly-over-sftp-in-eclipse-remote-system-explorer/
Quoting that article:
From Eclipse: Help -> Install New Software. “Work with: -All available sites-“. In the search box type “remote system”. Check “Remote System Explorer End-User Runtime”, click Next to proceed with the install.
After the wizard completed, click Window -> Open Perspective -> Remote System Explorer. Right-click in Remote Systems, choose New Connection, type in your details. After you connect, expand “Sftp Files” and you’ll be able to open remote files in the editor.
You can forward ports over SSH using the gcloud sdk
gcloud compute ssh example-instance \
--project my-project \
--zone us-central1-a \
-- -L 2222:localhost:8888
Once you have this setup you can connect direct in Eclipse
See details:
https://cloud.google.com/solutions/connecting-securely#Port%20forwarding%20over%20SSH
This is my first website (website itself is all done). I'm trying to upload my website files to my Openshift PHP 5.4 domain so when I click my OpenShift domain url, my website appears (pretty simple, right?). My Openshift account is set up. I've connected to it with FileZilla, and set up a private (or public) key. I've installed Ruby & Git. I followed everything here, and am stuck on this step:
Web Console
If you create an application from the web console, you’ll need to tell Git to clone the repository. Find the Git URL from the application page, and then run:
C:\> git clone <git_url> <directory to create>
I don't know what the "git_url" is supposed to be. Nor do I know what the "directory to create" is supposed to be. I don't know what OpenShift directory to put my website files in (when I connect with FileZilla) so that when I open my OpenShift domain url, I see my website (see below).
Again, my goal is to see my website when I open my OpenShift PHP 5.4 url. Where do I go from here?
Your problem is that you don't know what git is about, I recommend that you go read about it: https://git-scm.com/book/en/v1/Getting-Started
If you have your site ready and you've created an OpenShift app, do the following:
1) Grab the git url (you can find it by browsing to https://openshift.redhat.com/app/console/applications, clicking your app, and then copying the long address on the right, under "Source Code"), it should look something like this: ssh://afa231av#app-domain.rhcloud.com/~/git/app.git/
2) Open up a terminal (or use some git ui tool) and clone (download) your app with
git clone ssh://afa231av#app-domain.rhcloud.com/~/git/app.git
3) You should have a folder named app, now use the file explorer go inside it and paste in all your website
4) Go back to the terminal and do
cd app (or whatever name your app has)
git add .
git commit -m "Add my website"
git push origin master
Wait for it to finish, and if there are no errors, you're all done.
git_url: Go to OpenShift Web Console -> Application -> find and click your application, on the right there is Source Code panel with something like ssh://***.rhcloud.com/~/git/php.git/, this will be your git_url
directory_to_create: is just a name of directory that will be created that will contain your git repo on your local file system
When you clone this repo, you should copy your files to it, then commit and push to branch named 'master', and it will be automatically deployed on server.
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