Codeigniter Deployment Process - codeigniter

I have a CI 2.0 project under VCS w/ the repo hosted on my server. Currently I have a bash script that I've posted below. It checks out the source code, moves some files around, and restarts the server to reflect the updated web site.
Is there anything wrong w/ my current method? Does anyone else have any other recommendations on other tools I could use or ways to do it better? Thanks!
# Stop apache while we update the server, and export our svn repo to a tmp dir
sudo /etc/init.d/apache2 stop
svn export file:///home/steve/repository/example/trunk /home/steve/example_dev/
# Prepare the public_html folder for the update, and remove the tmp directory
rm -rf /home/steve/public_html/example.com/public/
mv /home/steve/example_dev/ /home/steve/public_html/example.com/public/
rm -rf /home/steve/public_html/example.com/public/license.txt
rm -rf /home/steve/public_html/example.com/public/user_guide
rm -rf /home/steve/example_dev
# Restart apache
sudo /etc/init.d/apache2 start

I work using a local WAMP directory, which stores the directories of my projects (something DreamWeaver automatically does). I then use DreamWeaver to work directly with the live server. So everytime I edit a file it overwrites in my local directory. Changes are made instantly on the live server, which then when I'm ready to commit to my SVN trunk I simply run SmartSVN (or whatever you use) then commit my local WAMP directory to the SVN.
I don't know if it's the best option really, but it's most likely better than rebooting your webserver for changes.

Well I have a found a much simpler way to update my site now. No longer am I restarting Apache either :) Check out my script below.
svn export --force file:///home/steve/repo/example/trunk \
/home/steve/public_html/example.com/public/

We use Capistrano for CI and other PHP deployments. It works pretty well. https://github.com/namics/capistrano-php

Related

Is gvfs-trash installed? in Atom

When I tried to remove a file in local machine to check files are synchronous with vagrant development server it pops up an error:
The following file couldn't be moved to the trash.
Is gvfs-trash installed?
For solving it I created a trash directory that can be accessed from outside the user’s home directory:
# Create a Trash directory (with some subdirectories) in root
sudo mkdir -p /.Trash-1000/{expunged,files,info}
# Give ownership of this to your user:
sudo chown -R $USER /.Trash-1000
Still I can't remove the file from local machine. But If I delete a file at vagrant development server it automatically deletes at local machine, opposite is not happening and ends-up with this error "Is gvfs-trash installed? "
Like YuriAFGomes said, everything seemed to work fine in my system: trash folder had the right permissions and gvfs-trash worked flawlessly from command line, yet atom 1.45 said it couldn't delete any file. Tried to start atom with sudo and it didn't fix anything. Tried creating the .Trash-1000 directories in several places, and nothing, same error related to gvfs-trash. I'm pretty sure this used to work fine in my atom setup and suddenly it stopped doing so, and I have no idea why. I went to their releases list and tried downgrading to several of them until I settled with version 1.30, which doesn't seem to have this issue and is compatibles with my local packages. If you have this problem and tried everything said around the web, I suggest you try downgrading to different versions until the problem goes away.
There is an issue on GitHub reporting this problem. According to the report, a missing .Trash-1000 can cause this problem, so you can create it as follows.
mnt=/; id=$(id -u); sudo mkdir -p "$mnt/.Trash-$id"/{expunged,files,info} \
&& sudo chown -R $USER:$USER "$mnt/.Trash-$id"/ \
&& sudo chmod -R o-rwx "$mnt/.Trash-$id"/
Set mnt to the mount point, where gvfs-trash is expecting it.
Simply cd to the directory which will be opened in atom and execute df ..
This will give something like this:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb1 960380628 463122460 448403708 51% /mnt/vol
In this example, the mount point and the value of mnt would be /mnt/vol.
What solved this issue for me was uninstalling atom via dpkg and installing it via apt from the following PPA: https://launchpad.net/~webupd8team/+archive/ubuntu/atom . I have no clue why this works, though. I have noticed that the PPA installs atom 1.26, while the version where the issue arised, installed via dpkg, is 1.45.
Before doing that, I have tried creating the .Trash-1000 directories in root, in home and in project folder, with the proper permissions. gvfs-trash was installed, updated and working as expected all the time, but the problem persisted. Really odd.
The real problem is that atom/electron are/were using gvfs-trash which has been deprecated for almost 5 years. Electron which is the platform on which Atom is built has fixed this in the development branch but hasn't backported it to the 2.0 branch on which Atom is based.
Solution/Workaround as of now?
Use an environment variable $ELECTRON_TRASH and set it to gio or one of the alternatives
See if you are missing the .Trash-1000 folder (assuming your uid is 1000)
Install an alternate gvfs-trash script to take over the missing functionality
Delete the file/folder outside of atom
I had a similar problem on Windows using Atom, where I couldnt delete the files. So I resorted to deleting them manually from the directory (outside of Atom).
Turns out atom cannot "move to trash" if u checked in recycle bin this option:
"Don't move files to the Recycle Bin. Remove files immediately when deleted."
Just set the other option (to move files to actual recycle bin) and should work.

Does using `wget --mirror --continue` as cron job strictly make sure that my files mirrors those in the server?

I am planning on using wget --mirror --continue on windows command prompt (i downloaded a win wget) to keep downloading all files from a server.
It works fine, it downloads, and I am planning to put this .bat on my windows task scheduler but I have a doubt since I am not familiar with wget, since it says --mirror. Does it also make sure those files in my local directory makes sure it is Strictly mirrors those in the server?
Because, what if:
I downloaded the files from the server using wget --mirror
the server deletes all its files
I run wget --mirror again
Will wget also delete all the files in my local?
Sorry I am not sure, and I cannot test since I do not have my own server.
Just a quick answer would be very helpful. Thanks!
I just tested with a minutely VPS and apparently wget does not delete them even the files are lost in the server.

Cannot Clone GIT Repository from windows server but can SSH

I have a seen a lot of posts related to the error I am getting but can't find anything that seems like a potential fix I would like to try without getting feedback from some people who know better.
The Setup: I recently built a Windows 7 PC and installed Apache, PHP and MySQL. Everything is working great with my setup and I opened the server up to other devices on the LAN. When I go to a browser and navigate to IPADDRESS:PORT (Installed Apache to listen on a custom port to avoid potential conflicts (Skype, future IIS install?, etc) I get my htdocs index.php page. Great so far.
The last thing I wanted to do was setup Git so that I can do work for my server on my Macbook Pro and push changes to the server. To get this up and running I installed msysgit on my server and was able to create a Git repository for a Media directory I created at the root of my server. When I open this directory up in Explorer I can see the .git directory. The next thing I did was install OpenSSH on the server and I got that up and running. I also changed the default home directory of an SSH connection to the htdocs folder of my Apache server.
Now when I move over to my Macbook pro to test the setup and I am getting problems.
SSH seems to be functioning as expected. When I am on my laptop and run ssh USERNAME#IPADDRESS I get the message to enter my password, I enter my login password and awesome I am in the shell of my server at the htdocs directory.
Git does not seem to be functioning as easily though. I have Git on my Macbook Pro and was able to create a repository in a local directory no problem. When I navigate to a new directory in Terminal that I would like to work with the Media folder project I created on the server and run the following Git commands:
git clone USERNAME#IPADDRESS:/Media
git clone USERNAME#IPADDRESS:\Media
git clone USERNAME#IPADDRESS:/Media.git
git clone USERNAME#IPADDRESS:/Media/.git
etc
(Not sure what exact command I'm supposed to be running. Do I need .git at the end of this command? I see a hidden .git directory in the Media directory but I don't see a Media.git file.)
I get the following error:
Received disconnect from IPADDRESS: 2: fork failed: Resource temporarily unavailable
fatal: The remote end hung up unexpectedly
Based on my searching I can't tell if this error is coming from my client (Macbook Pro) or server. I read that it could be a threading limit set on my Macbook so I entered the following commands and upped my maxprocperuid:
sudo sysctl -a|grep maxprocperuid (which outputted 709)
sudo sysctl -w kern.maxprocperuid=3000 (upped it to ridiculous number to see if it was the problem)
But I am still getting the error when trying to clone the repository.
If you've gotten to the end of this thanks, just trying to provide as much info as possible and any help would really be appreciated.
Thanks.
Try uninstalling OpenSSH and then installing WinSSHD again. Check out this link which suggests the same.
Also, this question might be of some help to you while you are at it.
Git doesn't use ssh by default so you have to specify it when cloning
git clone ssh://[username]#[ip-address]:[port][/path/to/repo]

Installing dropbox (and use Kirby CMS) on openshift

I'm trying to find a way to integrate Kirby CMS with Dropbox running on Openshift using these tutorials:
http://getkirby.com/blog/kirby-meets-dropbox
http://getkirby.com/forum/how-to/topic:561
I already get stuck installing Dropbox, since I assume I don't really have permission while SSHing:
http://www.dropbox.com/install?os=lnx
So my question: Is there even any way of achieving all that greatness? If no, not even if we get reaaaally creative? If NO, why not? If yes, how?
Thanks a bunch!
I have no experience with Kirby, but here's how to get Dropbox working on Openshift.
The following is a combination of doing a Dropbox install on a server and doing it in a non-standard location. Everything gets done in $OPENSHIFT_DATA_DIR because that's where you have write privileges.
First, make sure you're in $OPENSHIFT_DATA_DIR
cd $OPENSHIFT_DATA_DIR
Next, download the appropriate version of Dropbox:
wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -
This should give you the .dropbox-dist folder in $OPENSHIFT_DATA_DIR.
Next, tell Dropbox to start the installation process, but tell it that your home directory is actually the $OPENSHIFT_DATA_DIR:
HOME=$OPENSHIFT_DATA_DIR ./.dropbox-dist/dropboxd start -i
Follow the instructions to link your Dropbox account to the Openshift server. After it's linked, it should start syncing everything in your Dropbox account to $OPENSHIFT_DATA_DIR/Dropbox. This might be a bad thing for you because you have too much data in your Dropbox account. If so, then you should exclude folders.
You can do that with the CLI script that Dropbox provides. Still in $OPENSHIFT_DATA_DIR, download it:
wget -O dropbox.py "https://www.dropbox.com/download?dl=packages/dropbox.py"
Make sure it's executable:
chmod +x dropbox.py
You need to run it the same way you would Dropbox:
HOME=$OPENSHIFT_DATA_DIR $OPENSHIFT_DATA_DIR/dropbox.py -h
Hope that helps.
You should be able to download/compile/install things into your OPENSHIFT_DATA_DIR (app-root/data) on your gear by using something like ./configure --prefix=~/app-root/data/dropbox, i tried that but i ran into missing the nautilus-whatever package, which i assume you could download and install in the same fashion, but i did not try past that point. As long as whatever you are running can be installed into the app-root/data, and does not require root permissions to run, you should be able to do it. If you get it going, you could also create a downloadable cartridge to run install it more easily.

Setting up SVN repository on Remote machine with XCode 4.0

I have followed the documentation to setup the SVN repository for existing project. I followed following steps:
mkdir branches
mkdir tags
mkdir trunk
cp -R /myProject /SVN_Master/trunk
svnadmin create myProject_svn
svn import trunk/myProject file:///SVN_Master/myProejct_svn -m "Initial import"
It has set up SVN repository now. How can I checkout this? It isn't working when I try to checkout from XCode organizer, give path file:///SVN_Master/myProejct_svn. Am I missing something?
How could I setup the same thing for remote host(my server)? Can I just copy created local repository there and use that path?
Thanks.
Got this sorted. It was annoying though as Apple's documentation on this doesn't made any sense. The simple steps you should follow is,
Setup the SVN repository on remote Windows server. I used VisualSVN. I was able to setup in couple of minutes.
From MAC, checkout the code from terminal using "svn co http://serverurl/svn/projectname localdir" command.
Open the project.xcodeproj file and it will try to create repository for you automatically. Make sure that you enter correct user/pass when asked for.

Resources