リンクや環境のアドレスを引き取る

新しいボックスでは、リンクやコネクタ経由で外に出ていた名前を、sandbox_wire がその場で自分のプロセスや公開したバージョンに切り替えます。ボックスの URL は変わりません。

sandbox_status → health.features に take-over があるボックス(2026-09-25 12:40 UTC 以降に起動したボックスはすべてそう。イメージは box-202609251946。ボックスは起動したときの boxd を凍結と復帰をまたいで使い続けます)では、いまリンクやコネクタを通ってボックスの外に出ている名前を、sandbox_wire でボックス内のサービスに引き取れます:

sandbox_wire { "id": "<id>", "service": "billing.acme.internal", "port": 8080, "targetPort": 8081 }
sandbox_wire { "id": "<id>", "service": "billing.acme.internal", "port": 8080, "version": "refund-a1b2c3d", "env": { "WORKERS_ENABLED": "false" } }
  • 1 つ目は targetPort で待ち受ける自分のプロセス、2 つ目は公開したバージョンです(env と containerPort はいつもどおり使えます)。その name:port がリンクか環境のアドレスなら、どちらもその名前をその場で引き取ります。
  • 名前はボックス内のアドレスをそのまま保つので、DNS の答えをキャッシュしたプログラムもそのまま届きます。以後はボックス内の targetPort に届きます。
  • リンクやコネクタを通って開いていた接続は閉じられ、プログラムは接続し直して、今度はボックスのコピーに届きます。
  • リンクはリンクでなくなります。sandbox_status.services から fromBox と fromPort が消え、相手のボックスの linkedFrom にもこのボックスは出なくなります。ボックスの URL は変わりません。
  • 引き取りは、名前が外に出ているそのポートで行います。別のポートでは呼び出しは失敗します:<name> is reached through the connector or a link on port [<port>]; a name cannot be a service in the box on port <n> and go out on another。名前が複数のポートで外に出ているとき(環境に db.internal:5432 と db.internal:6432 があるなど)は、そのうち 1 つだけを引き取ることもできません:<name> is also reached through the connector or a link on port [<port>]; a name cannot be a service in the box on one port and go out on another。1 つの名前が、あるポートではボックス内のサービスで、別のポートでは外に出る、ということはできません。そうした名前は sandbox_start で宣言してください。そこではすべてのポートでボックスを指します。
  • リンクの名前で mode を切り替えると、常に 409 になります:<name> is a link in this box, which has no box or external mode. Wire it again with fromBox or fromPort to change where it goes, or pass port (and targetPort) to run the service in the box instead。

古いボックス(health.features に take-over がない)では:

  • リンクの名前に port を付けると 409 <name> is a link in this box, and box <id> runs boxd <version>, which cannot turn a link into a service in the box. Wire it again with fromBox or fromPort to change where it goes, or start a new box that declares the service、version を付けると <name> is a link in this box, and box <id> runs boxd <version>, which cannot turn a link into a published version. Start a new box that declares the version, or wire the link again with fromBox or fromPort になります;
  • port や version で加えた名前が環境のアドレスなら、コネクタ経由のままです。そうした名前は sandbox_start で宣言してください。

すべてのツールとトピックはツールリファレンスに並んでいます。