・2020/12/21
東京都 新型コロナウイルス感染症対策サイトをラズパイで動かす! 1GB版でも動作可能
(オープンソースの「新型コロナウイルス感染症対策サイト」を Raspberry Piで動かす)
Tags: [Raspberry Pi], [電子工作]
● Raspberry Piで「東京都 新型コロナウイルス感染症対策サイト」を動かす!
・Raspberry Piで「東京都 新型コロナウイルス感染症対策サイト」を動かす!

ラズパイで東京都 新型コロナウイルス感染症対策サイトを動かす!メモリ 1GB版でも動いた!
ラズパイ 3B 1GB版でもギリギリ動きます。
ラズパイ 4B 8GB版なら余裕で動きます!
※ 空きメモリが 1.5GB以上の環境を推奨します
それにしてもホント Node.js系?ってメモリを無駄にバカ食いするわ。
東京都 新型コロナウイルス感染症対策サイト
開発者向け情報
Yarn - Package Manager
Nuxt.js - ユニバーサル Vue.js アプリケーション
● 「東京都 新型コロナウイルス感染症対策サイト」とは?
一般社団法人 コード・フォー・ジャパンが開発したオープンソースの Webサイト
東京都新型コロナウイルス感染症対策サイト
Code for Japan
見たい未来は、自分でつくる 社会を変える力は我々ひとりひとりの中にある。 世の中づくりを面白く。 ともに考え、ともにつくろう。
技術要素
・静的ホスティング(固定の内容を表示)(1日数回の情報更新バッチで更新)
・Vue.jsのフレームワークの NuxtJSを使った SSR(Server Side Rendering)
The Progressive JavaScript Framework
使いやすい Vue フレームワーク
● Raspberry Piで「東京都 新型コロナウイルス感染症対策サイト」を動かす手順
キーポイント
・yarnの最新版をインストールする
元々の yarnだとバージョンが古すぎるので yarn installでエラーになります。
・node-gypをインストールする
node-gyp not found !で怒られます。
・メモリ使用量を制限する変更
ラズパイ3B等のメモリ 1GBの機種の場合は必要。
●ラズパイで「東京都 新型コロナウイルス感染症対策サイト」を最短で動かすスクリプト
sudo apt-get -y install curl git nano
sudo apt remove -y cmdtest
sudo apt remove -y yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get -y install yarn
yarn -version
# 1.22.5
git clone https://github.com/tokyo-metropolitan-gov/covid19.git --depth 1
cd covid19
sudo apt-get install -y node-gyp
yarn install
# 軽量モード アクセシビリティチェック(vue-axe)を無効
yarn dev-no-axe
# http://localhost:3000/ にアクセスする
● Raspberry Pi 4B 8GBは空きメモリが 7GB以上有るので余裕で動きます
free -h
# total used free shared buff/cache available
# Mem: 7.7Gi 143Mi 7.3Gi 52Mi 297Mi 7.3Gi
# Swap: 99Mi 0B 99Mi
uname -a
# Linux raspberrypi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux
sudo apt-get -y install curl git nano
cd
git clone https://github.com/tokyo-metropolitan-gov/covid19 --depth 1
cd covid19
# 2-1. yarn を使う場合
sudo apt-get install -y yarn
yarn --version
# 0.32+git
# yarnのバージョンが古いので動かない
yarn install
# 00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'
# yarnの最新版をインストールし直す
# https://classic.yarnpkg.com/ja/docs/install/#debian-stable
# Install yarn
sudo apt remove -y yarn
sudo apt remove -y cmdtest
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install -y yarn
yarn --version
# 1.22.5
# 安定版: v1.22.5
# Node: ^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0
yarn install
# error /home/pi/covid19/node_modules/fibers: Command failed.
# Exit code: 1
# Command: node build.js || nodejs build.js
# Arguments:
# Directory: /home/pi/covid19/node_modules/fibers
# Output:
# node-gyp not found! Please ensure node-gyp is in your PATH--
# Try running: `sudo npm install -g node-gyp`
# spawn node-gyp ENOENT
# node-gyp not found! Please ensure node-gyp is in your PATH--
nodejs -v
# v10.21.0
sudo apt-get install -y node-gyp
yarn install
# 軽量モード アクセシビリティチェック(vue-axe)を無効
yarn dev-no-axe
free -h
# total used free shared buff/cache available
# Mem: 7.7Gi 1.1Gi 4.9Gi 51Mi 1.7Gi 6.3Gi
# Swap: 99Mi 0B 99Mi
● NuxtJSの利用状況を匿名情報で送信する? Are you interested in participation ?
ℹ NuxtJS collects completely anonymous data about usage. 13:05:28
This will help us improving Nuxt developer experience over the time.
Read more on https://git.io/nuxt-telemetry
? Are you interested in participation? (Y/n) n
╭───────────────────────╮
│ │
│ Nuxt @ v2.14.12 │
│ │
│ ▸ Environment: development (dev-no-axe) │
│ ▸ Rendering: server-side │
│ ▸ Target: static │
│ │
│ Listening: http://localhost:3000/ │
│ │
╰───────────────────────╯
● NuxtJSのホストとポート番号を変更するには?
ホストとポート番号を変更するには?
デフォルトでは、Nuxt の開発サーバーのホストは localhost(ホストマシン内からのみアクセスが可能)です。
package.json
黄色の行を追加すると外部からもアクセスできる。
package.json
{
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "3000"
}
},
"name": "covid19",
"version": "1.0.0",
"description": "東京都 新型コロナウイルス感染症対策サイト",
╭───────────────────────╮
│ │
│ Nuxt @ v2.14.12 │
│ │
│ ▸ Environment: development (dev-no-axe) │
│ ▸ Rendering: server-side │
│ ▸ Target: static │
│ │
│ Listening: http://192.168.123.234:3000/ │
│ │
╰───────────────────────╯
● Raspberry Pi 3B 1GB
メモリの使用量を少なくする。
nuxt.config.ts 内の設定
黄色の行を追加するとメモリの使用量を少なくできる。
nuxt.config.ts
build: {
typescript: {
typeCheck: {
memoryLimit: 512,
workers: 1
}
},
postcss: {
NODE_OPTIONS=--max_old_space_size=2048
も
NODE_OPTIONS=--max_old_space_size=512
に書き換える。
https://github.com/tokyo-metropolitan-gov/covid19/search?q=2048
package.json
grep max_old_space_size package.json
# "generate:deploy": "cross-env GENERATE_ENV=production NODE_OPTIONS=--max_old_space_size=2048 nuxt-ts generate",
# "generate:dev": "cross-env GENERATE_ENV=development NODE_OPTIONS=--max_old_space_size=2048 nuxt-ts generate",
# 2048 to 512
sed -i 's/max_old_space_size=2048/max_old_space_size=512/' package.json
grep max_old_space_size package.json
free -h
# total used free shared buff/cache available
# Mem: 975Mi 134Mi 686Mi 11Mi 154Mi 778Mi
# Swap: 99Mi 0B 99Mi
# 軽量モード アクセシビリティチェック(vue-axe)を無効
yarn dev-no-axe
このメモリ状態でも動きました!
確率的に 3回実行して 1回くらい無事に起動する。
実行中の使用メモリ 779MB
free -h
total used free shared buff/cache available
Mem: 975Mi 779Mi 121Mi 5.0Mi 75Mi 156Mi
Swap: 99Mi 99Mi 0.0Ki
・Raspberry Piで「東京都 新型コロナウイルス感染症対策サイト」を動かす!
ここで 20分程度しても変化が無い場合は Ctrl+Cやターミナルを閉じて再度実行しなおす。
※ 緑色の Clientの 「69%」や 「88%」で止まったままになる事が多い。
・Raspberry Piで「東京都 新型コロナウイルス感染症対策サイト」を動かす!









・Raspberry Piで「東京都 新型コロナウイルス感染症対策サイト」を動かす!


nuxt / typescript Change worker memory limit #15
nuxt.config.js
export default {
build: {
typescript: {
typeCheck: {
memoryLimit: 512,
workers: 1
}
}
}
}
nuxt.config.ts
export default config: Configuration {
buildModules: [
['@nuxt/typescript-build', {
typeCheck: {
memoryLimit: 4096,
workers: 2
},
ignoreNotFoundWarnings: false
}]
]
}
https://hadoop.apache.org/docs/r2.6.1/hadoop-yarn/hadoop-yarn-common/yarn-default.xml
yarn.nodemanager.resource.memory-mb: 8192
yarn.nodemanager.resource.cpu-vcores: 8
yarn.scheduler.minimum-allocation-vcores: 1
yarn.scheduler.maximum-allocation-vcores: 32
yarn.scheduler.minimum-allocation-mb: 1024
yarn.scheduler.maximum-allocation-mb: 8192
● Vagrant を使う場合
# Vagrant を使う場合
動かない
Vagrant by HashiCorp
Vagrant + libvirt
libvirt: The virtualization API
sudo apt-get install -y vagrant
vagrant -v
# Vagrant 2.2.3
vagrant up
pi@raspberrypi:~/covid19 $ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
Error while connecting to libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/pi/.ssh/id_rsa:
Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
apt search libvirt
# vagrant-libvirt/stable,now 0.0.45-2 all [installed,automatic]
# Vagrant plugin that adds an Libvirt provider to Vagrant
sudo apt-get install -y vagrant-libvirt
vagrant plugin install vagrant-libvirt
3: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.3/lib/vagrant/action/builder.rb:116:in `call'
2: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.3/lib/vagrant/action/warden.rb:34:in `call'
1: from /usr/share/rubygems-integration/all/gems/vagrant-2.2.3/plugins/commands/plugin/action/install_gem.rb:30:in `call'
/usr/share/rubygems-integration/all/gems/vagrant-2.2.3/lib/vagrant/plugin/manager.rb:156:in `install_plugin': undefined method `name' for nil:NilClass (NoMethodError)
●新型コロナウイルス感染症対策サイト 全国版(非公式)
動かない
git clone https://github.com/mm0202/covid19-jp --depth 1
cd covid19-jp
動かない
yarn install
yarn dev-no-axe
# WARN Browserslist: caniuse-lite is outdated. Please run the following command: yarn upgrade
yarn upgrade
# ERROR ERROR in /home/pi/covid19-jp/packages/extensions/Domain/DataManager/JgJpnDataManager.test.ts(5,23):
5:23 Cannot find module '@/static/data/jg-jpn.json'.
3 | HeaderForTableData
4 | } from '@/packages/extensions/Domain/DataManager/JgJpnDataManager'
> 5 | import jgJpnJson from '@/static/data/jg-jpn.json'
| ^
6 |
7 | describe('JgJpnDataManagerクラスのテスト', () => {
8 | let dataManager: JgJpnDataManager
warning "vue-jest > ts-jest@26.4.4" has unmet peer dependency "typescript@>=3.8 <5.0".
warning " > vue-class-component@7.2.6" has unmet peer dependency "vue@^2.0.0".
error An unexpected error occurred: "expected manifest".
info If you think this is a bug, please open a bug report with the information provided in "/home/pi/covid19-jp/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
Tags: [Raspberry Pi], [電子工作]
●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)
【2020年版】NVIDIA Jetson Nano、Jetson Xavier NXの便利スクリプト
Jetsonの面倒な初期設定やミドルウェアのインストールを bashスクリプトの実行だけで簡単にできます
【2020年】Jetson Xavier NX 開発者キットが安かったので衝動買いした件、標準販売価格5万円が4万4千円!
【ザビエル元年】Jetson Xavier NX 開発者キットを最安値で購入で、しかも国内在庫で注文から翌日で到着、ザビエル開封レビュー
【2020年版】NVIDIA Jetson用に最新の CMake 3.17.3をビルドしてインストールする方法
2020年の JetPack 4.4になっても CMakeのバージョンが 3.10.2と古く OpenPoseのビルドでエラー発生の原因
【2020年版】NVIDIA JetPack 4.4 DP Developer Previewで OpenPoseのビルドエラーの対策方法
Jetson Nano、Jetson Xavier NX 開発者キット + JetPack 4.4 DPで OpenPoseをビルドする手順
Jetson Nano、Jetson Xavier NX 開発者キット TensorFlow on Jetson Platform
NVIDIA Jetson Nano、Jetson Xavier NX Developer TensorFlow on Jetson Platform
NVIDIA Jetson Nano 開発者キットを買ってみた。メモリ容量 4GB LPDDR4 RAM
Jetson Nanoで TensorFlow PyTorch Caffe/Caffe2 Keras MXNet等を GPUパワーで超高速で動かす!
【2020年版】NVIDIA Jetson Nanoの初期設定、最高速で動かす設定、空きメモリを増やす方法等
2020年の JetPack 4.4になっても nvccのパスがデフォルトで通って無いとか、初期設定が必要です
【2020年版】NVIDIA Jetson Nano JetPackのバージョン情報まとめ、JetPack 4.4は仕様変更の影響が大きい
最新の JetPackでは 2019年当時の殆どの記事の内容がそのままではエラーが出て動かない様になりました
【2020年版】NVIDIA Jetson Nano対応の FFmpegをビルドする手順
NVIDIA Jetson Nano対応の FFmpegをビルドする手順、x264と x265にも対応
【2020年版】NVIDIA Jetson Nano対応の OpenPoseをビルドする手順
NVIDIA Jetson Nano対応の OpenPoseをビルドする手順
NVIDIA Jetson Nanoで OpenCV 3をビルドしてインストールする方法、NVCaffe等の OpenCV 4未対応を動かす
NVIDIA Jetson Nanoに「古い」 OpenCV 3.4.10をビルドしてインストールする方法
NVIDIA Jetson Nanoで Visual Studio Code Open Sourceをビルドして実行する
NVIDIA Jetson Nanoで VSCode Open Source Code - OSSをビルドして実行する、1.35.0
【2020年版】NVIDIA Jetson Nanoで TensorFlowの StyleGANを動かして、顔画像を生成
NVIDIA Jetson Nano JetPack StyleGAN、敵対的生成ネットワーク AIで自然な顔画像を生成する
【2020年版】NVIDIA Jetson Nanoで StyleGANの改良版の StyleGAN2で自然な画像を生成
NVIDIA Jetson Nano JetPack StyleGAN2、敵対的生成ネットワーク AIで自然な顔画像を生成する
【2020年版】Jetson Nanoで StyleGANを動かして可愛い美少女のアニメ顔を大量生産する方法
【俺の嫁】Jetson Nanoで StyleGANと StyleGAN2のそれぞれで、敵対的生成ネットワーク AIでアニメ顔を生成
【メモリ8GB】Raspberry Pi 4 Model B 8GBを KSYで最安値で購入。ベンチマークレビュー
【技適取得】ラズパイ4B 8GBモデルを入手。従来の Pi3、Pi3B+と速度比較
【Vulkan】Raspberry Pi 4 Model Bで Vulkanドライバをビルドして 3Dグラフィックのデモを動かす
【v3dv】ラズパイ4Bで Vulkan APIを動かす、VK_ICD_FILENAMES broadcom_icd.armv7l.json
PIP機能付きの 4K対応の 4入力 1出力の HDMIセレクターを買ってみた、HDMI機器が複数有る場合に便利
ピクチャ イン ピクチャ機能付き 4K入力対応の 4入力 1出力 HDMI切り換え機 HDSFX0401P
EDID保持機能付きの 4K対応の 4入力 2出力の マトリックス切り替え HDMIセレクター、液晶画面 2台と使用で最強
TESmart HMA0402A30 マトリックス切り替えで液晶画面 2台に接続できて更に EDID保持の便利機能付き HDMI切り換え機
[HOME]
|
[BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c)
2020 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator
http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_corona_virus_tokyo_site/