Hosting code for an open source social media website - php

I'm building a social media network and I want to make the code publicly available so that anyone can contribute.
Can I use GitHub for this purpose?
Also, how do I decide which files should be hosted on the GitHub repository?

Yes, you can use Github or Bitbucket.
On which files should be on hosted on Github,
You should never have configuration files in your codebase.
You should not have node_modules
Based on the framework and technology stack you select, you can create your .gitignore file using https://www.gitignore.io/ to ensure that you don't commit configuration files, environment files, etc.

Related

How to edit php files after building angular app

I want to deploy my angular app on 000webhost. I used ng build to build my project and I uploaded my dist files to the file manager of the webhost. However, my website contains php files with credentials and urls linking to folders in the project such as :
baseUrl:string = "http://localhost/lfsa-db/php";
return this.httpClient.post(this.baseUrl + '/register.php', { first_name,last_name,father_name})
My dist files are all .js with the index.html. How can I edit these lines of code ? They were in a .php file before building the project.
Navigate to where your files are stored, make changes to those files and re compile your app / refresh the page. When you upload your files to 000webhost you should be able to make changes to them. If you can't, make changes to your angular app locally and re upload the files.
Hope this answers your question.
This is just my personal preference but I would use a git hub repo and deploy that. Using github will allow you to make commits to your branches and your web app will pull from the git hub, easy way to make changes after deploying.
When using webhosting software linking to a github gives you more control, at least in my opinion.

GitHub version control on FTP based website?

I am currently interacting with my sites via FTP, which can get quite annoying and impossible to manage at times.
Is it possible to use GitHub as a version control system for my PHP based websites which is on a different domain name?
If not, can anyone give me some advice on what tool I should look into using in order to set up version control.
You can create a git repository with all of your code for your website, and host it on Github. Then you can make changes, commit them to your local repository, and push them to Github. Afterwards, when you want to deploy your changes, do a git pull on your Github repository from the remote server.
Git is a distributed version control system. You have local repositories sitting in your local machine (your laptop, desktop, etc.) Github is a remote repository hosting service (sort of like Dropbox). When you want to sync the repo in your computer with the one hosted by Github, you do a pull/push. Then, you can sync the repository hosted by Github with the thrid repository on the server that hosts your website using a push/pull. No ftp is needed.
After a bit of research, found the solution to my question.
http://net.tutsplus.com/tutorials/tools-and-tips/how-to-use-git-with-ftp/

Using Git with shared hosting plan

So I started using Git together with this workflow to make a personal website (mostly for testing and to learn Git) and I am developing it locally on my laptop using Xampp.
But now I would like to make this website public and upload it to my webserver. Problem is, I use a shared hosting plan which means I only have FTP access to my website directory. Can't use SSH or install Git or anything..
I would like to deploy the website and any updates to that webserver, but I was wondering if that was possible with Git with only FTP access? And if not, what would be an advisable way to update my website? Manually drag an dropping files through Filezilla can get a bit tedious.
If you have no SSH access to the remote server and the hosting provider doesn't offer a git deploy feature, you won't be able to deploy directly using git.
However, it's always a good idea to track your source code regardless the remote options.
In your case, a good alternative to automate the release process would be to create a simple deploy script in your favorite programming language (Ruby, Python, Bash...) that loads the list of changed files from your git repository and performs an upload via FTP of these files.
A simple search for git-ftp reveals that there are already two projects that seems to do what I suggested:
ezyang/git-ftp
git-ftp/git-ftp
If you are in a shared hosting plan, its not a good idea to host your own git server as you'll have both space and bandwidth limitations. You can look out for other options such as github or if you want to have a private hosting, there is bitbucket
Maybe think about a different hosting set up?
On a VPS you have more freedom but you need to set up everything yourself.
On a cloud PaaS you will get great technology but pay a little more.
As mentioned above: A private repo hoster with ftp deployment option might also work.
For me, best productivity is most important. Compare costs of web hosting with costs for web development.
If git is installed on the server (e.g <?php $last_line = system('git --version', $retval); ?>), but you don't have SSH access, perhaps try php-git-bundle.
This question may be old but there is a shared web hosting which offers git deployment option and SSH access to git pull/push etc: githoster.com
Or there are some scripts you can search in google which will link your github account to your host with git hooks.

Separating CodeIgniter config file Git for publishing publically

I am about to start a CodeIgniter based project and plan on using Git as our DVCS. I will be working with a few other developers, and the central (origin) server is privately hosted. But I also want to open source it and publish the code to Github later.
My question is, is there a way to separate the config file(s) in Git, so that the private information in the config file is not sent to the Github remote but is to origin and other peers.
Another question is could we use a similar solution for having local development config files and a server one for production?
Create the files config.php.sample and database.php.sample that each of your developers will use that has a placeholder for the passwords and other sensitive information. Add config.php and database.php to your .gitignore
The first time you deploy to the production site, you'll create the config.php and database.php files. Subsequent pushes won't overwrite config.php and database.php since they're not included in the git repository.
Codeigniter has some support for environments (Development, Production, etc).
Refer to official documentation , CodeIgniter Environments.
Regarding config files, you can use .gitignore
http://progit.org/book/ch2-2.html
Edit:
Since you have used github tag in the question; Github now has an option to add .gitignore file (they have a codeigniter template too )
You should use a deployment tool to set the config file when deploying your application to the destination system.
capistrano with railsless-deploy is a good option

Dealing with SVN and FTP and dynamic files created/changing on the server?

Basically I've got various projects all version controlled using subversion. This is for many reasons: backup of files in case of bugs/issues in the future; backup of files in case of local system failure etc; collaboration from others in the company; etc..
One of the systems we work with is Wordpress which does updates and installs plugins through its administration panel and such, plus on installing it the system creates various files (including a wp-config.php file and a .htaccess file). This means that on install there are files on the server integral to the running of the system which aren't on the local systems and aren't in svn. Plus any installed plugins and updates aren't mirrored in version control or the local copy.
Plus it feels wrong (specifically when you compare with data normalisation in databases and such) to be working with two copies of the same code - one in version control and one on the server.
So my question is am I using the tools in the right way? Is there any way that the public_html folder from the server can "point" to the latest version in the repo? Or can SVN be configured to read from the public_html folder and automatically add+commit any files created/edited on the server?
Or do people just literally download anything that gets changed/created and add them to SVN manually? Or do people not care? Maybe I've misinterpreted what SVN is for? I'm using it for backup effectively.
Thanks
Tom
I only have versioned my own wordpress theme. All the other stuff including the data is live on the server and solely backuped from there.
The code of wordpress and the plugins used are developed elsewhere, they have their own repositories, and i do not mess mine with code I never will touch.
The question is how to deal with configurations. I am currently running a wiki where I document all the plugins installed live and what configuration properties I have set up.
A sync of live to local then goes like this:
Update wordpress version and plugins to the versions written in the wiki
Setting all configuration options as written in the wiki.
Importing the data base (except wp_options). Converting the static URL of wp_content files to the local scheme.
Syncronisation of the wp_content directory
In many cases your hosting provides regular backup. But is you use VPS you have more freedom to do whatever you want. I have made my public_html folder under version control and created a small script to commit every night. So I can have a complete version history of my site with changes traced. You can also create a script just to copy this folder elsewhere. There may be other better solutions for enterprises, but this may be enough for small project.

Categories