DataSource Athena

Redashにおいて表題の通り使えるように設定した。

■ 環境

  • Amazon Athena
  • Redash 3.0.0

■ Data Sources

画面右上のデータベース(?)のマークで”Settings > DATA SOURCES“。

+New Data Source“から追加する。

  • Type: Amazon Athena
  • Name: 自身がわかりやすい名前で。athenaとつけておいた。
  • AWS Region: 使用するAthenaのリージョンを。ap-northeast-1。
  • AWS Access Key: Athenaの権限を持つアクセスキーを登録。
  • AWS Secret Key: AccessKeyと対のものを。
  • S3 Staging Path: Athenaの実行結果やメタ情報が出力されるS3のパスを指
  • 定。
  • Schema Name: デフォルトでは”default”のようだ。無記入でもOK。
  • KMS Key: 無記入

上記で設定し、”Test Connection“も試し”Success“となればOKである。

設定後ではあるが下記のようになった。

以上。

■ 関連

redash 3.0.0 upgrade

echoで表示する内容にタブ

表題の通り。知らなかったのでメモ。

■ 環境

  • sh

■ echo -e

スクリプトの中で情報を表示する際に`echo`で出すが、見栄えをよくする為に文字列の途中でタブを入れたかったので下記のようにやってみたところイメージと違う。

$ echo "aaa\tbbb"
aaa\tbbb
$

シングルクォートで括っているわけでもないのにな、と思っていたら制御文字を有効にするにはオプションが必要なようであった。

$ man sh
  :
 echo [-neE] [arg ...]
  Output  the  args,  separated  by  spaces, followed by a newline.  The return status is always 0.  If -n is
  specified, the trailing newline is suppressed.  If the -e option is given, interpretation of the  following
  backslash-escaped characters is enabled.  The -E option disables the interpretation of these escape charac-
  ters, even on systems where they are interpreted by default.  The xpg_echo shell  option  may  be  used  to
  dynamically determine whether or not echo expands these escape characters by default.  echo does not inter-
  pret -- to mean the end of options.  echo interprets the following escape sequences:
  \a     alert (bell)
  \b     backspace
  \c     suppress trailing newline
  \e     an escape character
  \f     form feed
  \n     new line
  \r     carriage return
  \t     horizontal tab
  \v     vertical tab
  \\     backslash
  \0nnn  the eight-bit character whose value is the octal value nnn (zero to three octal digits)
  \xHH   the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
  :
$

というわけで”-e“オプションをつけて再度実行する。

$ echo -e "aaa\tbbb"
aaa    bbb
$

思い通りの結果を得ることができた。

以上。

■ 関連

Macでの`echo -n`

シークレットウィンドウが使用不可

MacのGoogleChromeにおいて表題の通りである…。職場の環境では”シークレットモード/シークレットウィンドウ“が使用できない。

■ 環境

  • Google Chrome
  • macOS High Sierra

■ シークレットモード/シークレットウィンドウ

Googleにログインしていない状態でアクセスしたかったのでシークレットウィンドウで開けば良いか、と思ったのだがどうやって開けば良いのかわからず…。たしかここにあったはず、と設定の箇所を探したのが見つけられず…。ショートカットを試してみるも反応せず…。

しばらく悩んで、お手上げで検索し、”policy“なる設定がされているかも?とたどり着いた。

chrome://policy

上記で確認すると、”IncognitoModeAvailability“が”1“で設定されている。これがシークレットウィンドウの使用を不可としているもののようだ。書き換えようと思ったのだが編集すら不可となっていた。どうやら職場のセキュリティ製品によるもののようだ…。

シークレットウィンドウが使用できなかったので、”ゲストモード“で実施した。結果的に”ゲストモード“でやりたいことは十分であった。

ちなみにようやく自宅のマシンも職場のマシンもmacOS High Sierraにアップグレードした。

以上。

■ 関連

chrome://chrome-urls

Drupal@Docker

表題の通り。ここ数日セキュリティ界隈で盛り上がりそう(?)なDrupalを触ったことがないのでDockerで動かしてみる。

■ 環境

  • Drupal 8.5.0
  • Docker for Mac
  • Mac OSX El Capitan

■ Drupal@Docker

久しぶりのDockerなのでversionを確認しておく。

$ docker version
Client:
 Version:    17.12.0-ce
 API version:    1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built:    Wed Dec 27 20:03:51 2017
 OS/Arch:    darwin/amd64

Server:
 Engine:
  Version:    17.12.0-ce
  API version:    1.35 (minimum version 1.12)
  Go version:    go1.9.2
  Git commit:    c97c6d6
  Built:    Wed Dec 27 20:12:29 2017
  OS/Arch:    linux/amd64
  Experimental:    true
$

コンテナイメージを取得する。

library/Drupal – Docker Hub
https://hub.docker.com/_/drupal/

$ docker pull drupal

コンテナを起動する。

$ docker run --name drupal -p 8080:80 -d drupal

ブラウザでアクセスする。

http://localhost:8080/

インストールしてみる。

とりあえず”標準“で良いであろう。

どのようなものかお試しのインストールなので、別途永続化したRDBのコンテナは用意していないので”SQLite“でインストールする。

しばし待つ。

必要事項を入力。

しばし待つ。

インストールが完了したようだ。

少し触ってみよう。そしてお祭りに備えよう。

以上。

redash 3.0.0 upgrade

表題の通り。公式のAMIで起動しているredashで下記のような表示がされていたのでupgradeしてみた。たぶん使い始めた時にはすでに表示されていたはずである…。

■ 環境

  • redash 2.0.0 → 3.0.0
  • Ubuntu 16.04
  • AWS

■ redash upgrade

New Redash version available“のリンクからアクセスし、upgradeの方法を確認してみる。

Re:dash Releases
https://version.redash.io/

最新版である”3.0.0“の”Upgrade Instructions“から下記にアクセスした。

How to Upgrade | Redash
https://redash.io/help/open-source/admin-guide/how-to-upgrade

この通りコマンドを実行したがエラーとなった。

$ sudo /opt/redash/current/bin/upgrade
Starting Redash upgrade:
Found version: 3.0.0
Current version: 2.0.0+b2990
* Before doing an upgrade, please make sure you have a backup.
* If you have any issues, please refer to the troubleshooting section in the upgrade guide:
https://redash.io/help-onpremise/maintenance/how-to-upgrade-redash.html
* If the upgrade guide doesn't help, you can ask for help on the forum (https://discuss.redash.io).

Full CHANGELOG for this release: https://github.com/getredash/redash/blob/master/CHANGELOG.md
Continue with upgrade? (y/n): y
Downloading release tarball...
Unpacking to: redash.3.0.0.b3134...
Changing ownership to redash...
Linking .env file...
Installing new Python packages (if needed)...
Running migrations (if needed)...
Failed running: sudo -u redash bin/run ./manage.py db upgrade
Exit status: 1
Output:
Traceback (most recent call last):
  File "/opt/redash/redash.3.0.0.b3134/manage.py", line 6, in 
    from redash.cli import manager
  File "/opt/redash/redash.3.0.0.b3134/redash/__init__.py", line 70, in 
    import_query_runners(settings.QUERY_RUNNERS)
  File "/opt/redash/redash.3.0.0.b3134/redash/query_runner/__init__.py", line 175, in import_query_runners
    __import__(runner_import)
  File "/opt/redash/redash.3.0.0.b3134/redash/query_runner/big_query.py", line 18, in 
    import apiclient.errors
  File "/usr/local/lib/python2.7/dist-packages/apiclient/__init__.py", line 19, in 
    from googleapiclient import discovery
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 71, in 
    from oauth2client.client import GoogleCredentials
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 47, in 
    from oauth2client import crypt
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/crypt.py", line 45, in 
    from oauth2client import _openssl_crypt
  File "/usr/local/lib/python2.7/dist-packages/oauth2client/_openssl_crypt.py", line 16, in 
    from OpenSSL import crypto
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in 
    from OpenSSL import rand, crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 105, in 
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

$

前述のURLの”Troubleshooting“に記載があったので”pyOpenSSL“のversionを確認すると、”3.0.0“では”16.2.0“が必要なようである。現状を確認。

$ pip list --format=legacy | grep pyOpenSSL
pyOpenSSL (0.14)
$

まずは”pyOpenSSL“から”upgrade“する必要があるようだ。

$ sudo pip install --upgrade pyOpenSSL

再度versionを確認すると下記のようになった。

$ pip list --format=legacy | grep pyOpenSSL
pyOpenSSL (17.5.0)
$

随分と上がったがまぁ良いだろう。これで再度”upgrade“を実行する。

$ sudo /opt/redash/current/bin/upgrade
Starting Redash upgrade:
Found version: 3.0.0
Current version: 2.0.0+b2990
* Before doing an upgrade, please make sure you have a backup.
* If you have any issues, please refer to the troubleshooting section in the upgrade guide:
https://redash.io/help-onpremise/maintenance/how-to-upgrade-redash.html
* If the upgrade guide doesn't help, you can ask for help on the forum (https://discuss.redash.io).

Full CHANGELOG for this release: https://github.com/getredash/redash/blob/master/CHANGELOG.md
Continue with upgrade? (y/n): y
Downloading release tarball...
Unpacking to: redash.3.0.0.b3134...
Changing ownership to redash...
Linking .env file...
Installing new Python packages (if needed)...
Running migrations (if needed)...
Linking to current version...
Restarting...
Done! Enjoy.
$

画面上でもフッターのversionが”3.0.0“になったのを確認することができた。

以上。

■ 関連

DataSource Athena