LoginSignup
0
0

More than 3 years have passed since last update.

AzureのAppServiceのRubyイメージではtiny_tdsを利用できない

Last updated at Posted at 2020-05-03

概要

タイトルの通りですが、AzureのAppserviceで使えるRubyのデフォルトイメージだとfreeTDSのバージョンが古いため、
tiny_tdsを使ってSQLServerへの接続ができませんでした。

対処法

Appserviceコンソールなどからは対処不可、自前のコンテナイメージ使いましょう。
なお、RubyのデフォルトイメージのgithubにPRあがってるみたいだがまだ未処理
これがマージされれば使えるかな?
https://github.com/Azure-App-Service/ruby/pull/38

以下、いろいろ検証してみたこと。

AppServiceのコンテナをローカルで使ってみる

いろいろ調べるとdockerイメージが公開されている。
https://github.com/Azure-App-Service/ruby
(DockerHubにもある)

これを使って色々と。

こちらにローカルで使う方法がありましたので、それを実行。
https://github.com/Azure-App-Service/teamblog/blob/master/docs/Images.md

docker pull appsvc/<ImageTag>

docker run \
    -d -it -P \
    --volume $(pwd):/home/site/wwwroot \
    --env PORT=8080 \
    --publish 8080:8080 \
    appsvc/<ImageTag> 

curl localhost:8080

docker exec -it <container> bash

これでひとまずは動く。(別にrailsのアプリの場所でなくても大丈夫そう)
で、localhost:8080を叩くと、AppServiceのおなじみの画面が出る。

Bad Request

ここからbashでコンテナに入ってみて、いろいろ確認。

$ apt show freetds-bin
Package: freetds-bin
Source: freetds (0.91-6)
Version: 0.91-6+b1
Installed-Size: 750 kB
Maintainer: Steve Langasek <vorlon@debian.org>
Depends: libc6 (>= 2.17), libgnutls-deb0-28 (>= 3.2.10-0),
libgssapi-krb5-2 (>= 1.10+dfsg~), libodbc1 (>= 2.3.1), libreadline6 (>= 6.0), libsybdb5 (>= 0.82),
libtinfo5, freetds-common
Homepage: http://www.freetds.org/
Tag: interface::commandline, role::program
Section: database
Priority: optional
Download-Size: 217 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian/ jessie/main amd64 Packages
Description: FreeTDS command-line utilities

(freetds-devも同じような感じ。)
ということで、0.91のfreetdsが入ってる。しかし、直近のtiny_tdsではDo you have FreeTDS 0.95.80 or higher installed?
とか言われる。
tiny_tdsのバージョンを落とせば入るかもしれないが、0.91に対応してるバージョンを見つけるのが大変なのでここで打ち切り。

ちなみにbashで入ったとき、gemとかはここにある。
/usr/local/.rbenv/versions/2.6.2/bin (Rubyのバージョンは置き換えて)

最後に

早くマージしてほしい。

0
0
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
0
0