LoginSignup
0
0

More than 5 years have passed since last update.

cloud9で、Apartment(マルチテナント)の動作確認をするには

Posted at

やりたいこと

  • Railsでapartmentを使ってマルチテナントなサービスを作る。
  • Cloud9環境でやりたい

Cloud9はサブドメインが使えない

image.png

でも、マルチテナントなサービスをCloud9で動作確認したいんだ! というときには・・・

Ngrok使えばいける

永続的に使うには課金が必要ですが、一時的に動作確認ができればいいや!というのであれば、
ngrokを使うことで、サブドメインで住み分けするマルチテナントの動作確認ができます!

$ ngrok https 8080

ngrok by @inconshreveable                                                                                                                           (Ctrl+C to quit)

Session Status                online                                                                                                                                
Account                       xxxx xxxx  (Plan: Free)                                                                                                             
Version                       2.2.8                                                                                                                                 
Region                        United States (us)                                                                                                                    
Web Interface                 http://127.0.0.1:4040                                                                                                                 
Forwarding                    http://xxxxxx.ngrok.io -> localhost:8080                                                                                            
Forwarding                    https://xxxxxx.ngrok.io -> localhost:8080                                                                                           

Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                           
                              7       0       0.00    0.00    21.72   221.30 

みたいなのが出たら、あとは https://xxxxxx.ngrok.io にアクセスするだけで、
xxxxxxのテナントを呼び出す環境がサクッと出来上がります!

Railsコンソールで
Apartment::Tenant.create("xxxxxx")

Railsコンソールで↑のように新たにテナントを作って、
簡単にマルチテナントを試験する環境ができました!

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