2016年2月7日日曜日

OpenShiftってSSHでログインもできるんだ

このエントリーをはてなブックマークに追加
Remote Connection (SSH)を見てみたら普通にSSHでGearにログインできるみたいなのでやってみた。


$ rhc ssh myphpapp
RSA 1024 bit CA certificates are loaded due to old openssl compatibility
Connecting to 56b61d5c89f5cf92a000003f@myphpapp-xxxxxx.rhcloud.com ...

    *********************************************************************

    You are accessing a service that is for use only by authorized users.
    If you do not have authorization, discontinue use at once.
    Any use of the services is subject to the applicable terms of the
    agreement which can be found at:
    https://www.openshift.com/legal

    *********************************************************************

    Welcome to OpenShift shell

    This shell will assist you in managing OpenShift applications.

    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
    Shell access is quite powerful and it is possible for you to
    accidentally damage your application.  Proceed with care!
    If worse comes to worst, destroy your application with "rhc app delete"
    and recreate it
    !!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!

    Type "help" for more info.


[myphpapp-xxxxxx.rhcloud.com 56b61d5c89f5cf92a000003f]\>
でも使えるコマンドは限られてるみたい。
\> help
Help menu: The following commands are available to help control your openshift
application and environment.

gear            control your application (start, stop, restart, etc)
                or deps with --cart      (gear start --cart mysql-5.1)
tail_all        tail all log files
export          list available environment variables
rm              remove files / directories
ls              list files / directories
ps              list running applications
kill            kill running applications
mysql           interactive MySQL shell
mongo           interactive MongoDB shell
psql            interactive PostgreSQL shell
quota           list disk usage

Deprecated:
ctl_app         control your application (start, stop, restart, etc)
ctl_all         control application and deps like mysql in one command
簡単なの使ってみよう。
[myphpapp-xxxxxx.rhcloud.com 56b61d5c89f5cf92a000003f]\> ls
app-deployments  app-root  git php
[myphpapp-xxxxxx.rhcloud.com 56b61d5c89f5cf92a000003f]\> pwd
/var/lib/openshift/56b61d5c89f5cf92a000003f
ファイルやディレクトリは見える。
[myphpapp-xxxxxx.rhcloud.com 56b61d5c89f5cf92a000003f]\> ps -aef
UID         PID   PPID  C STIME TTY          TIME CMD
2385     182328 181214  0 13:13 ?        00:00:00 sshd: 56b61d5c89f5cf92a000003f@pts/1
2385     182339 182328  0 13:13 pts/1    00:00:00 /bin/bash --init-file /usr/bin/rhcsh -i
2385     189163 182339  2 13:14 pts/1    00:00:00 ps -aef
2385     423174      1  0 12:12 ?        00:00:00 /usr/sbin/httpd -c Include /var/lib/openshift/56b61d5c89f5cf92a000003f
2385     423175      1  0 12:12 ?        00:00:00 /usr/bin/logshifter -tag php
2385     423184 423174  0 12:12 ?        00:00:00 tee
2385     423185 423174  0 12:12 ?        00:00:00 tee
2385     423186 423174  0 12:12 ?        00:00:00 /usr/sbin/httpd -c Include /var/lib/openshift/56b61d5c89f5cf92a000003f
2385     434288 423174  0 12:14 ?        00:00:00 /usr/sbin/httpd -c Include /var/lib/openshift/56b61d5c89f5cf92a000003f
動いているプロセスも見えるみたい。
[myphpapp-xxxxxx.rhcloud.com 56b61d5c89f5cf92a000003f]\> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
OSはRedHat EnterPrise 6.7か。
[myphpapp-xxxxxx.rhcloud.com 56b61d5c89f5cf92a000003f]\> env
MANPATH=/opt/rh/php54/root/usr/share/man:
OPENSHIFT_SECRET_TOKEN=wD_1nmlzQ0FN8WHQ_Xs5hsUAiermXB5i7GVLGFP1N7w6_wGfnAT9PZNgwecEUpOGAJIp1ER8Ao-lGBwx8dU_8Q9fqn-R482B6JF9aySaXIXp9ScZZ8xY0Q_MeqZPzFJ1
OPENSHIFT_PHP_IDENT=redhat:php:5.4:0.0.28
OPENSHIFT_GEAR_MEMORY_MB=512
SELINUX_ROLE_REQUESTED=
OPENSHIFT_DEPLO
:
:
helpには書いてないけどenvで環境変数も見えるみたい。

0 件のコメント:

コメントを投稿