Upload HTML website files to Openshift PHP 5.4 - php

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.

Related

Uploading PHP dynamic website into Google Cloud Lamp Stack

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

How to check instance is running in heroku

I am creating a website on PHP.
I have cloned the source code. using git clone
Create an app on Heroku heroku create and deployed my code on heroku using command git push heroku master.
Now i want to check either my instance is running or not. How to check?
Thanks for your time.
You can run heroku open, which will open your app in your default web browser. Of course you can also manually navigate to your app's URL, which should be be https://<your-app-name>.herokuapp.com.
You can also run heroku ps which will show your app's dynos and their status.
Both of these heroku commands accept an --app argument in case you want to run them from outside of your project directory or have multiple apps configured.
As stated in official documentation of heroku
Ensure that at least one instance of the app is running:
heroku ps:scale web=1

If an app is deployed to Heroku from Cloud9, does every change made in a file in the app needs to be pushed to Heroku manually?

My PHP app is stored in Cloud9 and I deployed it to Heroku from Cloud9 Git terminal.
Now there is a .json file in the app files, has a value stored, which comes from a value entered by the user in a TextField in the User Interface of the app.
The question is that whenever the user changes the value in the TextField, and saves the changes (in the source code, saving corresponds to writing the changes to the .json file), will someone have to commit (using $ git commit) and push (using $ git push heroku master) these changes from Cloud9 to Heroku? Or will that happened automatically?
Your Heroku repo is simply a remote repo as far as cloud9 is concerned. Type:
git remote -v
in cloud9 to see your remotes.
Files from your cloud9 repo only get deployed to Heroku when you do a git push.

Using git with a website that has user uploads

okay i'll explain my issue short:
I have a website, lets say a board where user can chat and upload avatars, images, files etc.
I want to use git with this website.
So what i did:
created a repo with bitbucket
clone this repo local
adding a .gitignore file (see below)
copied my website to my local repo
made a first commit
push everything to bitbucket
Bitbucket now has my website, but without my ignored files and folders
my .gitignore looks like this (e.g):
uploades/user/avatars
cache/
logs/
Okay next step:
I'm logging in with ssh to my webserver
clone the bitbucket repo
Now my website is online without any user files (uploades, images, files etc...)
So if a user now uploades something in the git ignored folders i want the files to remain.
When i make local php changes and push it again to bitbucket and then do a "git pull" on my webserver all user files are deleted.
What do i miss? What is the best procedure?
SSH to the server and manually create uploades folder. You don't want uploades folder to be in git. I assume it doesn't have any code, and all it has is user content - so just leave in on the server.
This is how I push my local repo to a remote live server: I create a bare repo on the server, and push local repo to remote repo (on local add origin as remote). Once remote repo (which is outside my public directory) is up to date, I go to my public directory (public_html) and git clone from my other remote repo. Works like a charm.
First time setup: send local repo to remote server
On remote server create bare repo:
git init --bare myproject.git
On my local machine:
git remote add origin user#ip:sshport/git_path_of_bare_repo/myproject.git
Send local changes to remote bare repo
git push origin master
On the remote server, login into your public directory (public_html, or /var/www/, or whatever your document root is):
git clone /path/to/your/bare/repo/above/myproject.git
Inside your public directory, create whatever folders you need (uploads, logs, tmp, whatever). Further git pulls will not delete these folders.
That's it!
Sending further updates from local to remote
From your local machine just type:
git push origin master
Now your local changes are on your remote repo. On your server go to your public directory (step#4 above), and pull updates:
git pull
Works for me perfectly.

How can you create in Netbeans a new PHP project with source files located in local network?

I'm trying to create a new PHP project in a situation where our client gave us only remote desktop connection to to their files.
How does it work usually in Netbeans:
To put it simple when a project is created with external sources we can click in our project on the single file and upload and download it (via ftp).
I'd like to be able to do this also on remote files located in a server which can be reached by our local network but which hasn't ftp installed.
Extra details
Until now we have been able to work normally with this setup by using Dreamweaver which allows to set in the server options an address located in the local network.
I really would like to switch to Netbeans and being able to click on upload and download on the local files to sync with their server but I can't find a way to achieve this.
There seem to be no option when creating a new project that allows this kind of setup. Selecting remote website seem to allow only ftp synch.
On the other hand if i select "Local web site" i can select the files in the local network, but NB doesn't allow me to make a local copy of them.
note 1: the server we're accessing hasn't ftp installed.
note 2: the "copy files from sources folder to another location" isn't really an option for me since I'd like to keep separated my local copy from what's on the server (and this setup I think would just copy the files without giving me any control on them).
note 3: creating a project with existing sources seem to allow only to have remote files reachable via ftp.
It would be useful to have some versioning system (git, mercurial, svn...). Can you mount the network drive in Windows? (see here ). This would at least allow you to easily create project from existing sources (although working via network could be quite slow)
One hacky way I can think of is to:
mount the network drive as described above and map it to some letter, say Z
install local FTP server (e.g. FileZilla)
configure FileZilla FTP server to use the network drive as "ftp home" (aka the folder which FileZilla will use for saving files sent over FTP) - simply use Z:\ path to point to the mounted network drive mapped to letter Z
in NetBeans, create a new PHP project from remote server (where remote server is actually your local FileZilla server)
In theory, this should work.
Here is the fragment from NetBeans site:
To set up a NetBeans project for an existing web application:
Choose File > New Project (Ctrl-Shift-N on Windows/Cmd-Shift-N on OS X).
Choose Java Web > Web Application with Existing Sources. Click Next.
In the Name and Location page of the wizard, follow these steps:
In the Location field, enter the folder that contains the web application's source root folders and web page folders.
Type a project name.
(Optional) Change the location of the project folder.
(Optional) Select the Use Dedicated Folder for Storing Libraries checkbox and specify the location for the libraries folder. See Sharing Project Libraries in NetBeans IDE for more information on this option.
(Optional) Select the Set as Main Project checkbox. When you select this option, keyboard shortcuts for commands such as Clean and Build Main Project (Shift-F11) apply to this project.
Click Next to advance to the Server and Settings page of the wizard.
(Optional) Add the project to an existing enterprise application.
Select a server to which to deploy. If the server that you want does not appear, click Add to register the server in the IDE.
Set the source level to the Java version on which you want the application to run.
(Optional) Adjust the context path. By default, the context path is based on the project name.
Click Next to advance to the Existing Sources and Libraries page of the wizard.
Verify all of the fields on the page, such as the values for the Web Pages Folder and Source Package Folders.
Click Finish.

Categories