LoginSignup
12
11

More than 5 years have passed since last update.

Vagrant上のCentOS7.1でPlayFramework開発環境を用意し、Herokuにデプロイするまで

Posted at

必要なミドルウェアのインストール

# git
sudo yum install -y git
# ruby
sudo yum install -y ruby

# java8
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.rpm
rpm -ivh jdk-8u65-linux-x64.rpm

他はお好みで。

svmのインストール

mkdir -p $HOME/.svm
git clone https://github.com/yuroyoro/svm $HOME/.svm

svmへのパスを通す

.bashrcに下記を追記

export PATH=$HOME/.svm:$PATH
if [[ -d "$HOME/.svm/current/rt" ]]; then
  export SCALA_HOME=$HOME/.svm/current/rt
  export PATH=$SCALA_HOME/bin:$PATH
fi

scalaのインストール

2015/11/22時点では2.11.7が最新の模様

svm install 2.11.7
svm use 2.11.7

playフレームワークのインストール

wget http://downloads.typesafe.com/typesafe-activator/1.2.12/typesafe-activator-1.2.12-minimal.zip
unzip typesafe-activator-1.2.12-minimal.zip
mv activator-1.2.12-minimal /usr/local/lib
ln -s /usr/local/lib/activator-1.2.12-minimal/activator /usr/bin/activator

下記コマンドが通っていれば成功

activator -help

play-scala Applicationの雛形作成

下記のコマンドを実行

activator new test-app
Choose from these featured templates or enter a template name:
  1) minimal-akka-java-seed
  2) minimal-akka-scala-seed
  3) minimal-java
  4) minimal-scala
  5) play-java
  6) play-scala

と聞かれるので、6を選択

playサーバを起動

cd test-app
activator run

playはローカル環境では9000番ポートを使うのでここにアクセス。

なにはともあれ、git commitしておきましょう。

git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git init
git add .
git commit -m "init"

Heroku toolbeltのインストール

wget -qO- https://toolbelt.heroku.com/install.sh | sh
echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

下記コマンドが通っていれば成功

heroku --version

Herokuへのデプロイ

cd test-app
heroku create
git push heroku master

だけでデプロイできました。

参考)
CentOS 7 に svm を使って Scala を入れる
CentOS 7 に Play Framework 2.3 を入れる
ScalaのPlayフレームワークをvagrant環境に構築する方法
[Scala] 初めてのScala on Play Framework on Heroku
説明と違う!MacのPlay初心者がver.2.3インストールでつまづくポイント
MacOS XでVagrantにCentOS入れ、Railsアプリ制作、Heroku公開 vol.08
CentOS6.xにOracleのJDK8をインストールする

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11