Root privileges to install ruby gems on Openshift - privileges

How can I get root privileges in my Openshift app? I need to install additional gems to my Openshift virtual machine and it's impossible to do it without superuser privileges.
For login, I'm using SSH:
ssh generated-hash#myapp-myns.rhcloud.com
I've already entered my id_key.pub to the Openshift web interface and I'm doing SSH with no password.

To install additional gems in openshift see this forum, copied from ramr answer:
So what you would need to do is add a Gemfile + Gemfile.lock to your
app and then do a git push -- see
https://github.com/openshift/rails-example for an example
Gemfile+Gemfile.lock.
Steps to do that: 1. Create an appropriate Gemfile -- probably
something like:
source 'http://rubygems.org'
gem 'whois'
gem "minitest"
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(local_gemfile)
end
On your workstation do a bundler install bundle install (you might
need to gem install bundler before you can use bundler). That should
create a Gemfile.lock - add that and the Gemfile and commit git add
Gemfile Gemfile.lock, git commit Gemfile Gemfile.lock -m 'added deps'
Push changes to your OpenShift App git push HTH

Related

Bitrise x Danger : bundle install, Could not locate Gemfile in "Do anything with Script step"

I'm new to CI, bitrise.
I've connected bitrise, project and Github and succeeded vanilla build.
Now I'm trying to show Auto PR comments on Github by using Danger connecting bitrise.
However, after pushing commits and making a pull request, the build was failed with this error on "Do anything with Script step" phase on bitrise.
What does "Could not locate Gemfile" mean in this case?
I have already added gemfile in local by these commands,
// create gemfile on the project directory
$ bundler init
// add danger in gemfile
gem "danger"
// install
$ bundle install
$ bundle exec danger init
And I've done
adding DANGER_GITHUB_API_TOKEN and github Access token in Env vars in bitrise
adding scripts in Do anything with Script step
This is my script.
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# these 2 lines are what I added
bundle install
bundle exec danger
# write your script here
echo "Hello World!"
# or run a script from your repository, like:
# bash ./path/to/script.sh
# not just bash, e.g.:
# ruby ./path/to/script.rb
Is something missing to make Danger work in Github?
I have no idea what's going on here and I don't know even where I need to check.
If you have any ideas, please help me.
Feel free to ask me if you need more info to solve this.
Thanks.
This was happening to me because I was executing the Danger script before the Git Clone Repository step in my workflow.. It can't find the Gemfile because it's not in the correct directory; $BITRISE_SOURCE_DIR is not set prior to the Git Clone Repository step.

How to develop custom cocoa-pod of your existing Xcode project?

If you want to create you own cocoapods with storyboards, XIBs, resources and with other frameworks such as Alamofire, MBProgressHUD etc.
Easy steps to create Cocoapod from existing xcode project
Create a repository on your git account (Repo name, check README,
choose MIT under license).
Copy the url of your repository.Open terminal and run following command.
git clone copied your repository url
Now copy your Xcode project inside the cloned repository folder on
your Mac. Now run following commands
git add -u to add all files (if not added use: git add filepath/folder)
git commit -m "your custom message"
git push origin master
Create a new release to go to your git repository or run following commands
git tag 1.0.0
git push --tags
First, we need to make sure that you have CocoaPods installed and
ready to use in your Terminal. run the following command:
sudo gem install cocoapods --pre
Creating a Podspec 
All Pods have a podspec file. A podspec, as its name suggests,
defines the specifications of the Pod! Now let’s make one, run
following command on terminal
touch PodName.podspec
After adding and modifying your .podspec file. Validate your .podspec
file by hitting following command on terminal
pod lib lint
Once you validate it successfully without errors run following
command to register you and build cocoapod respectively
pod trunk register  
pod trunk push PodName.podspec
If all goes well, you will get this on terminal
🚀 PodName (1.0.0) successfully published
📅 February 5th, 02:32
🌎 https://cocoapods.org/pods/PodName
👍 Tell your friends!
Yeah!!!!! congrats you have got your pod link. Use wherever you want to use it.
Here is some useful links . You can follow the same.
https://www.appcoda.com/cocoapods-making-guide/
https://www.raywenderlich.com/5823-how-to-create-a-cocoapod-in-swift

openshift rhc you do not have git installed

I am trying to setup the rhc client for openshift. I followed the tutorial precisely. After installing ruby, git and the rhc gem, the setup went perfect. But it wont clone my app to my computer. When I type rhc git-clone it says that git is not installed, but git --version works fine.
Ok, git installs itself default in users\\appdata\local\Git . I read somewhere that you shouldn't mess with the folder. But older versions installed in program files. So i tried that and rhc found it immediatly.
So just install git in C:\Program Files\Git
Just an additional piece of information to RiverWalker's self answer: run the git install as 'administrator'. Then "C:\Program Files\Git" directory will be used as the default installation dir.

how to install Wompt

I'm trying to install Wompt chat service on my web hosting but I couldn't find the correct way. I looked in the internet but failed to find a tutorial which explains how to install it.
Here is the GitHub link for the open source Wompt service:
https://github.com/Wompt/wompt.com
*Wompt is a web-based muti-rooms chat service. have a look at wompt.com
Thanks in advance.
Azam
The documentation has a very clean installation guide:
Installation
Node 0.6
git clone https://github.com/ry/node.git
cd node
git checkout v0.6.5
./configure
make
make install
MongoDB
wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.4.tgz
tar -xzf mongodb-linux-i686-2.0.4.tgz
mv mongodb-linux-i686-2.0.4.tgz /someplace/in/your/path
Wompt
git clone git#github.com:Wompt/wompt.com.git
cd wompt.com
git submodule update --init
Wompt authentication server
cd wompt.com/authentication
gem install bundler
bundle

How to deploy jekyll on slicehost

I have jekyll blog up and running locally. I am not sure how to push the content to slicehost. They have an instruction page but I am not able to follow the instruction.
I have all my content on github. Just need to know how to make post-update hook work?
To deploy a generated Jekyll site, you just need to copy the contents of the local _site directory to the appropriate remote directory on your server (often public_html, but it depends on the server configuration).
Personally, I think the easiest way is to just use rsync, assuming you can use rsync with your server. Then it's as simple as executing the command
$ rsync -avz --delete _site/ user#host:/path/to/web/root
to deploy your site. For my Jekyll-based sites, I encapsulate this in a Rake task so I can just do
$ rake site:deploy
to copy the site to the server.
If you can't use rsync, you can always transfer the _site directory via FTP, which is also pretty easy to do (and with a bit of Ruby scripting, can be automated using Rake as well).
You can use Git, as noted in the Jekyll docs. You will have to have Git installed on your server, and access to using it. If that's the case, you have to create a bare Git repo on your server. In the bare repo, you then create a post-update hook to check out the latest copy of the site. You do this by creating a script at $BARE_REPO/hooks/post-update with contents like the following (as noted here):
#!/bin/sh
unset GIT_DIR && cd /path/to/web/root && git pull
You then clone the bare repository to your web root, like so:
$ cd /path/to/web/root
$ cd ..
$ rm -rf root
$ git clone /path/to/bare/repo.git root
As you can see, it's often easier to use rsync or FTP instead of Git.