mysqlworkbench without root access - mysql

I have a full normal user account for ssh access and I'd like to use the mysql diff capability of mysqlworkbench's mysqldbcompare (or some other cli tool if it exists). The problem is I don't have root access. Can I install this in my normal user account so I can compare my DB's on that server?

The best way to do such things is to install them as root using the system's package manager, but I'm sure you know that :P
I downloaded the source code from their website, and it uses a traditional configure script. I have installed programs, in fact whole ecosystems, in unprivileged user accounts using configure scripts. Usually all it takes is to specify where you want files to be installed:
./configure --prefix=$HOME/eco
Sometimes you have to install dependencies too. Then make sure to set LD_LIBRARY_PATH accordingly.
Depending on the distro you're using, you can even install packages to your home directory: see this question

Related

Customizing a GCE Ubuntu VM image

I have a Google Cloud Platform account that I access from a VirtualBox VM. I am using the Google Compute Engine for a project that I am currently working on, and I had to create a custom image based on the Ubuntu 14.04 image that's available there.
I made changes to the Ubuntu image by ssh'ing into an Ubuntu 14.04 instance, (from my Vbox VM terminal) installing the Matlab compiler runtime, and downloading some other files that I needed. I created the custom image by following the steps according to the documentation.
However, now the changes I made are only available to me when I SSH from my Vbox VM terminal. I need to be able to run a certain matlab program Via startup scripts, how can I make it so that all users using this image have access to the customizations I made? Is there a way I can do this without having to make the edits by ssh'ing from the developers console and redoing all the changes?
EDIT: I don't think I was very clear so Ill give some examples. say my Google account is alexanderlang. When I ssh into an instance created from my custom image from the developers console, bash prompt looks like:
alexanderlang#myinstance $
My Vbox username is alex, and when I ssh into the same instance from my vbox terminal, bash prompt looks like:
alex#myinstance $
alex#myinstance can run matlab programs, but alexanderlang#myinstance cannot. I'm talking about the same instance, created from the same image. I think this might have something to do with the ssh keys for my custom image, but I don't know how to change or remove those keys.
When you connect to your VM instance via ssh by using either Developers Console or gcloud, the user account is dynamically created (if it doesn't already exist) by setting metadata on the VM. The question is: how does each tool choose your username?
When you use Google Developers Console, the only information it knows about you is your Google Account name, so it uses that, e.g., <first-name>_<last-name> or similar.
When you connect to your instance via gcloud, it knows the value of $USER so it uses that instead.
Note that in either case, your account has passwordless sudo access, so if you want to switch from one account to the other, you can run:
sudo su alex
while logged in as alexanderlang and then you have access to all the programs that alex does.
Similarly, you can run:
sudo su alexanderlang
while logged in as alex to do the reverse.
Startup scripts run as root. To run commands as another user, you need to do two things:
change to that username
run commands as that user
sudo su alex will create a new shell and hence ignore the rest of the script (until you manually exit the user shell, which is not what you want).
You can use sudo su alex -c 'command to run' but since what you want to run is a complex script, you need to first save the script to a file, and then run it.
Your options are:
pre-create the shell script to run
dynamically generate it from the startup script
Doing (1) is easy if the script never changes. For frequently-changing scripts (and it sounds like, many dynamically created VMs), you want to use option (2).
Here's how to do this in a startup script:
cat > /tmp/startup-script-helper.sh <<EOF
# ... put the script contents here ...
EOF
sudo su alex -c '/tmp/startup-script-helper.sh'
You can use Packer to create a derived image from a stock GCE VM image. Packer will let you do the following very easily:
boot a GCE VM using an image you specify
run some customization step, e.g., shell script, or Chef/Puppet/etc.
save the resulting image in your Google Cloud Platform project
Then, you can boot any number of new VMs using your newly-created image.
Note that since your VM image will be stored on Google Cloud Storage, you will be charged for the space it uses. Current pricing for Google Cloud Storage standard class is USD $0.026 / GB / month. A typical VM image should be less than 1GB.
You can see a complete example of how I used Packer to build VMs and pre-installed Ambari on it via my GitHub repo.

Accessing git to install mysql on server on gandi.net

I purchased a Simple Hosting instance using node.js/mysql on gandi.net.
I'm trying to set up my database, but I'm having some issues with connectivity.
I found some sample code to connect and talk to the database (which I set up via PHPMyAdmin), but it requires the mysql module (which I assumed would already be installed on my instance, but since I don't know how any of this works, that's fine).
I get the error:
Error: Cannot find module 'mysql'
in my log file.
I'm at a loss though as to how to actually install the module.
I tried to use their SSH console (via a firefox plugin), but my SSH credentials don't have the permission to run 'npm install mysql' and sudo isn't installed.
I also tried to install Git for Windows from mysisgit but I have zero idea how to connect to my remote server from this tool.
I'm just looking for some advice on how to proceed. I'm totally new and am engaging in learning this for personal development, so I don't have a lot of info on where to turn. Thanks!
The problem was that I wasn't using SSH to install to the correct directory (I was just trying to run it directly when I logged into shell). I needed to navigate into my web/vhosts/default/ directory, then the 'npm install mysql' worked absolutely fine.

OpenShift Enterprise creating directories in root file system

We have several applications that look in a standard location for configuration on the file system. Something like:
/config/db/
There would simply be too many changes required to many applications to use $OPEN_SHIFT_DATA_DIR instead. Is there a way to put files in arbitrary directories? Do i have to create a custom cartridge that would put the config directory there? Are there any permissions restrictions that I'll run into?
I don't have much experience with OSE, but only OSO. My guess would be that you should package up your configurations as an RPM and install it as root on the system, with permissions that are permissive enough for the gears users to be able to access them. Then release a new RPM for configuration changes. Installing a cartridge to a gear should never allow the data to be accessed by another gear, or be able to install something to anywhere that is not in that users selinux container.

Mercurial on share host without SSH

I am trying to get mercurial to work on a shared host without SSH access.
I have looked through https://www.mercurial-scm.org/wiki/PublishingRepositories and seen different means to publish my repository to the web but not been able to get any method to work because of certain dependencies.
For example, I looked at hgweb, it says
"First of all, you need to have a Python installation that can access the mercurial package. Verify this by running python and typing the following:
import mercurial"
I havent worked with python before and as such not sure where to run the "import mercurial" command. i am guessing via ssh for which i do not have access.
Also came across SCM-Manager, the quick guide just talks about downloading the source and extracting the content to your server, SCM manager depends on java and also not sure how to get that to work over the web.
Which of hgweb, SCM-Manager and RhodeCode is possible to set up without ssh access?
Short Answer: NONE
But you can at least try, if you have Java Application Server running (Tomcat, GlassFish etc), run SCM-manager as Web application (*.war)

Package Java web app along with jboss, mysql and activemq for deployment

I have a springframework web application that uses JBoss, MySQL and ActiveMQ.
At the moment, I have to install and configure JBoss, MySQL and ActiveMQ and JBoss manually.
What is the best way to package the application so a user can maybe do a one click install (on Linux platform, maybe Windows too?)
The "proper" way to do it is to pull down the source or src.rpms (or the equivalent of src.rpms depending on your distro) and repackage them correctly. If you have never messed with packaging linux application then this will probably take you a long time and will yield mediocre results unless you are willing to invest a lot of time.
An easier method is to write a shell script. Copy every shell command you type into a .sh file and run that file as a privileged user. If you edit files manually (with vim, emacs or gedit) instead edit the files with perl, sed, and awk, or just crush the files by curl'ing the modified version from a local webserver or copied from scp.
You can include the commands to install the packages as well as configure them in the script if you like.
As far as ActiveMQ is in question, you can always embed it in your application. Take a look at http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html for more info