Cara Upload File Ke OpenShift Red Hat Cloud

Untuk melakukan upload file ke OpenShift RedHat Cloud tidak menggunakan service FTP seperti web hosting pada umumnya tetapi harus menggunakan Git. Yang sudah sering menggunakan Git akan lebih mudah. Selain Git kita juga membutuhkan Ruby untuk instalasi rhc (OpenShift client tools). Saya telah melakukan instalasi untuk distro Linux Ubuntu, untuk instalasi pada sistem operasi lainnya baca di developers.openshift.com.

-Install Git-

[INPUT]

1 sudo apt-get install git-core

-Install Ruby-

Ruby diinstall pada virtual environment.

[INPUT]

1 sudo apt-get install curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Download rbenv dan Ruby via Git

[INPUT]

1 2 3 4 5 6 7 8 cd git clone git://github.com/sstephenson/rbenv.git .rbenv echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”‘ >> ~/.bash_profile echo ‘eval “$(rbenv init -)”‘ >> ~/.bash_profile   git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build echo ‘export PATH=”$HOME/.rbenv/plugins/ruby-build/bin:$PATH”‘ >> ~/.bash_profile source ~/.bash_profile

Jadi setiap ingin menjalankan rbenv ketik

[INPUT]

1 source ~/.bash_profile

Jalankan perintah install Ruby 2.2.2 pada rbenv

[INPUT]

1 2 rbenv install -v 2.2.2 rbenv global 2.2.2

Cek instalasi Ruby

[INPUT]

1 ruby -v

-Install rhc-

[INPUT]

1 gem install rhc

-Setting rhc-

[INPUT]

1 rhc setup

[INPUT]

1 2 Login to openshift.redhat.com: mail@email.com Password: password

Selanjutnya akan dibuatkan key

[INPUT]

1 2 3 OpenShift can create and store a token on disk which allows to you to access the server without using your password. The key is stored in your home directory and should be kept secret. You can delete the key at any time by running ‘rhc logout’. Generate a token now? (yes|no) yes Generating an authorization token for this client … lasts about 1 day

Lokasi key

[INPUT]

1 2 No SSH keys were found. We will generate a pair of keys for you. Created: /home/user/.ssh/id_rsa.pub

Upload key

[INPUT]

1 2 3 4 5 6 Your public ssh key must be uploaded to the OpenShift server to access code. Upload now? (yes|no) yes   Since you do not have any keys associated with your OpenShift account, your new key will be uploaded as the ‘default’ key   Uploading key ‘default’ from /home/user/.ssh/id_rsa.pub … done

-Upload/Download Source Code-

Clone/download source code dari repository aplikasi OpenShift. Alamat repository berada pada halaman setting aplikasi yang sudah terinstall pada OpenShift.

OpenShift – Repository

[INPUT]

1 git clone ssh://idaplikasi@namaaplikasi-username.rhcloud.com/~/git/namaaplikasi.git/

Buka folder hasil clone, lakukan perubahan. Setelah perubahan selesai lanjut ke proses upload/push ke server.

[INPUT]

1 2 3 git add -A git commit -m “update source code” git push

selamat mencoba 🙂

referensi: developers.openshift.com digitalocean.com

Leave a Reply

Your email address will not be published.