Skip to content

Instantly share code, notes, and snippets.

@dixonsiu
Last active February 7, 2019 02:44
Show Gist options
  • Save dixonsiu/6c0b902d2d7685be1a80bc9efecdb75b to your computer and use it in GitHub Desktop.
Save dixonsiu/6c0b902d2d7685be1a80bc9efecdb75b to your computer and use it in GitHub Desktop.
Provide procedures to jump start the Vagrant version of Personium Unit to live

Why I provide this Vagrant box for Personium beginners

When you just want to try out Personium APIs or play around with the applications provided from Took a very long time to construct the Vagrant version. Basically it always failed to be installed in proxy environment.

Tested in Windows 10, no problem.
In Windows 7, powershell must be updated.
In some laptop, Bios configurations are needed to run VirtualBox.

How to install and turn on the user-friendly Personium Unit

1. How to deploy

  1. Download personium_unit_20190128.box to your computer (specify a folder).

  2. Move to the folder and execute the following command.
    vagrant box add p_unit personium_unit_20190128.box

  3. Init the box on the company computer using the following command.
    vagrant init p_unit

  4. Add the following lines to the newly created Vagrantfile.
    Sample file/Sample file (behind authenticated proxy).

    ... config.vm.network "forwarded_port", guest: 443, host: 443 config.vm.network "private_network", ip: "192.168.33.10" ... config.vm.provider "virtualbox" do |vb| vb.memory = "2048" end

  5. Run vagrant up

  6. Ignore the authenticate error.

  7. Run vagrant up again

  8. Crtl-C to stop the process.

  9. Check out the VirtualBox Manager, you will see a VM is running.

2. How to get login information

  1. Execute the following command to SSH to the Personium Unit.
    Password is "vagrant"
    vagrant ssh
  2. Execute the following command to gain root permission.
    sudo su -
  3. Execute the following command to get the Unit Admin password (e.g. "JeoougAiHxbBcffx").
    cat /root/ansible/unitadmin_account
    unitadmin JeoougAiHxbBcffx

3. How to login to the Unit Manager

  1. Access the following URL from the browser.
    https://localhost/app-uc-unit-manager/__/html/login.html
  2. Login information

That's it!!! You can start using the Personium Unit.

For those who would like to add something to the Personium Unit and release it to other users, you can check out the following procedures.

Complete procedures for creating this user friendly Vagrant box

How to package the official built

  1. Install virtual box and vagrant at home.
  2. Clone the following respository to your PC.
    https://github.com/personium/setup-vagrant
  3. Execute the following command to construct your server.
    Wait for 20 minutes.
    vagrant up
  4. Execute the following command to SSH to your Personium Unit.
    vagrant ssh
  5. Execute the following command to gain root permission.
    sudo su -
  6. Uncomment the following line in "/etc/ssh/sshd_config".
    PasswordAuthentication yes
  7. Exexute the following command to restart sshd service.
    systemctl restart sshd.service
  8. Special operations:
    • Update Unit Manager
    • Install and modify HomeApp (localhost)
    • Install and modify market
    • Install and modify Minimal App
    • Create and modify dummy user cell
  9. Wrap up the vagrant machine using the following command.
    • syntax
      vagrant package --base {{machine name as it shows in virtual box}} --output {{filename of box}}
    • Example
      vagrant package --base setup-vagrant_default_1548245529126_19233 --output d:personium_unit_20190128.box
  10. Upload personium_unit_20190128.box to Google Drive

How to enable the relayhtml option for Personium Unit

  1. Add the following line to the file "/personium/personium-core/conf/18888/personium-unit-config.properties"
    io.personium.core.cell.relayhtmlurl.default=https://localhost/app-cc-home/__/index.html

  2. Execute the following command to restart tomcat
    systemctl restart tomcat

How to apply latest fixes to Personium Unit

When the official release are not ready, Vagrant version will not construct Personium Unit with the latest fixes.
However, you can compile your own war files or ask the core member to provide the bug fixed war files to you.
Execute the following procedures to apply the fixes to your Personium Unit.

  1. Download the war files (personium-core.war, personium-engine.war, etc) provided by the core members.
  2. Upload the war files to your Personium Unit (usually under the your home directory "/home/vagrant/")
  3. SSH to your Personium Unit (vagrant ssh or use mobaxterm)
  4. Execute the following command to gain root permission
    sudo su -
  5. Copy the war files (personium-core.war, personium-engine.war, etc) to the following folder.
    /opt/tomcat/webapps/
  6. Execute the following command to restart tomcat
    systemctl restart tomcat
@aki-nasu
Copy link

aki-nasu commented Feb 7, 2019

素晴らしいです、環境の提供ありがとうございます。
私のPCで立ち上げて触っています。

そのなかで、event関連について以下の事象がありましたので共有いたします。
※Gistを投稿されてすぐにダウンロードしたBoxを使用しておりますので、
アップデートされておりましたら私の環境は古くなっている可能性があります。

事象

※記載内容は、一部マスクしております。
デモ環境とローカル環境で同一のルールを登録しているが、ローカル環境ではログ出力されない。
ルールに記載しているBoxおよびodataの定義も同一構成(のつもり)です。

手順

  • POST https://{CELL_NAME}__ctl/Rule で以下のルールを登録
{
  "_Box.Name" : "boxname",
  "Name" : "ruleName",
  "EventExternal" : false,
  "EventType" : "odata.create",
  "EventObject" : "personium-localbox:/odata/EntityName",
  "Action" : "log.info"
}
  • 上記のEventObjectに記載しているentityにデータを登録

  • セルマネージャから default.log をダウンロードして確認

  • デモ環境の default.log には以下のログが出力されるが、ローカル環境では出力されない。

2019-02-07T02:03:03.637Z,[INFO ],"PCS-1549504983647","false","","https://demo.personium.io/cellname/#me","odata.create","https://demo.personium.io/cellname/boxname/odata/entityname('xxxxxxxxxxxxxxxxxxxxxxx')","201,https://demo.personium.io/cellname/boxname/odata/entityname"

情報が不十分で申し訳ありません。
調査にあたりどのあたりのログを見れば良いか、どの設定を意識したほうが良いかなどがわかっておりません。
そのあたりご教示頂きましたら確認いたします。

もしくは、他の方の環境で上記イベントの設定を試した時に成功するようであれば、少なくとも
私の設定の問題であることが分かると思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment