LoginSignup
12
13

More than 5 years have passed since last update.

VMware AppCatalystの使い方

Last updated at Posted at 2015-06-23

AppCatalystでできること

MacOS上のFusionにコンテナ実行環境としてVMware Photonを起動することが可能になる。
Vagrantのバックエンドとしても利用可能。HashicorpのVMware Vagrant Providerも不要になる。

VMware AppCatalystのインストール

VMwareからAppCatalystをダウンロード (要ユーザー登録)

https://my.vmware.com/group/vmware/get-download?downloadGroup=APPCATALYST10
Photonの仮想マシンイメージファイルが含まれているためでかい。
ダウンロードしたdmgファイルを展開して、インストーラーを実行

PATHの追加

appcatalystの実行ファイルへのパスを追加

~ vi ~/.bash_profile
export PATH=/usr/local/bin:$PATH:/opt/vmware/appcatalyst/bin

~ source .bash_profile

Photonインスタンス(仮想マシン)の作成

~ appcatalyst vm create demo
Info: Cloned VM from '/opt/vmware/appcatalyst/photonvm/photon.vmx' to '/Users/masanara/Documents/AppCatalyst/demo/demo.vmx'

作成したインスタンスのパワーオン

~ appcatalyst vmpower on demo
2015-06-23T10:44:12.374| ServiceImpl_Opener: PID 11660
Info: Completed power op 'on' for VM at '/Users/masanara/Documents/AppCatalyst/demo/demo.vmx'

作成したインスタンスのIPアドレスの確認

~ appcatalyst guest getip demo
172.16.42.129

作成したインスタンスにSSHしてdocker利用

~ ssh -i /opt/vmware/appcatalyst/etc/appcatalyst_insecure_ssh_key photon@172.16.42.130
Last login: Fri Jun 19 20:51:42 2015 from 192.168.217.1
photon [ ~ ]$ sudo docker run -d -it -p 80:80 vmwarecna/nginx
Unable to find image 'vmwarecna/nginx:latest' locally
Pulling repository vmwarecna/nginx
6d36a12c92d5: Download complete
511136ea3c5a: Download complete
e977d53b9210: Download complete
c9fa20ecce88: Download complete
184d60f5cc4f: Download complete
96d31e36bd8a: Download complete
fd2224b9a216: Download complete
7f3a2bd1e995: Download complete
4c4851e85e94: Download complete
560d74bc7ae1: Download complete
07f0aa77ae76: Download complete
126105e511b8: Download complete
775024331ffa: Download complete
db26ae25be15: Download complete
Status: Downloaded newer image for vmwarecna/nginx:latest
cf70979da837a6214fa345847cfc1083e9b354c8fe99b2e16f1cc4c6422d10e3

Vagrantからの利用

appcatalyst-daemon を実行して、http://localhost:8080 にアクセスすれば、APIの利用・確認が可能。

Vagrant Providerとしてvagrant-vmware-appcatalystが提供されいているため、appcatalyst-daemonをVagrantのバックエンドとして利用することも可能になる。(VMware Vagrant Providerは不要)

こんな感じ

Vagrant -> vagrant-vmware-appcatalyst -> appcatalyst-daemon -> AppCatalyst -> VMware Fusion

vagrant-vmware-appcatalystのインストール

~ vagrant plugin install vagrant-vmware-appcatalyst

Vagrantfile

# Set our default provider for this Vagrantfile to 'vmware_appcatalyst'
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'vmware_appcatalyst'

nodes = [
  { hostname: 'photon', box: 'vmware/photon' },
]

Vagrant.configure('2') do |config|

  # Configure our boxes with 1 CPU and 384MB of RAM
  config.vm.provider 'vmware_appcatalyst' do |v|
    v.vmx['numvcpus'] = '1'
    v.vmx['memsize'] = '384'
  end

  # Go through nodes and configure each of them.j
  nodes.each do |node|
    config.vm.define node[:hostname] do |node_config|
      node_config.vm.box = node[:box]
      node_config.vm.hostname = node[:hostname]
    end
  end
end

vagrant up

~ vagrant up
Bringing machine 'photon' up with 'vmware_appcatalyst' provider...
==> photon: Importing base box 'vmware/photon'...
    photon: Cloning VM, this might take a while...
==> photon: Checking if box 'vmware/photon' is up to date...
2015-06-23T12:22:28.832| ServiceImpl_Opener: PID 17495
==> photon: Waiting for machine to boot. This may take a few minutes...
    photon: SSH address: 172.16.42.137:22
    photon: SSH username: vagrant
    photon: SSH auth method: private key
    photon:
    photon: Vagrant insecure key detected. Vagrant will automatically replace
    photon: this with a newly generated keypair for better security.
    photon:
    photon: Inserting generated public key within guest...
    photon: Removing insecure key from the guest if its present...
    photon: Key inserted! Disconnecting and reconnecting using new SSH key...
==> photon: Machine booted and ready!
==> photon: Setting hostname...
Vagrant attempted to execute the capability 'change_host_name'
on the detect guest OS 'linux', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.

appcatalystで確認

vagrantで作成した仮想マシンが、appcatalyst経由で作成されている。

~ appcatalyst vm list
Info: VMs found in '/Users/masanara/Documents/AppCatalyst'
vagrant-1b74345a-a50e-48fc-9863-be344d5022fd
12
13
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
13