|
461 | 461 | </li> |
462 | 462 |
|
463 | 463 | <li class="md-nav__item"> |
464 | | - <a href="#3-run-the-deploy-on-the-remote-environment" class="md-nav__link"> |
| 464 | + <a href="#3-set-the-target-connection" class="md-nav__link"> |
465 | 465 | <span class="md-ellipsis"> |
466 | | - 3. Run the deploy on the remote environment |
| 466 | + 3. Set the target connection |
467 | 467 | </span> |
468 | 468 | </a> |
469 | 469 |
|
| 470 | +</li> |
| 471 | + |
| 472 | + <li class="md-nav__item"> |
| 473 | + <a href="#4-run-the-deployment" class="md-nav__link"> |
| 474 | + <span class="md-ellipsis"> |
| 475 | + 4. Run the deployment |
| 476 | + </span> |
| 477 | + </a> |
| 478 | + |
| 479 | + <nav class="md-nav" aria-label="4. Run the deployment"> |
| 480 | + <ul class="md-nav__list"> |
| 481 | + |
| 482 | + <li class="md-nav__item"> |
| 483 | + <a href="#do-i-need-network" class="md-nav__link"> |
| 484 | + <span class="md-ellipsis"> |
| 485 | + 🤔 Do I need --network? |
| 486 | + </span> |
| 487 | + </a> |
| 488 | + |
| 489 | +</li> |
| 490 | + |
| 491 | + </ul> |
| 492 | + </nav> |
| 493 | + |
470 | 494 | </li> |
471 | 495 |
|
472 | 496 | </ul> |
|
546 | 570 | </li> |
547 | 571 |
|
548 | 572 | <li class="md-nav__item"> |
549 | | - <a href="#3-run-the-deploy-on-the-remote-environment" class="md-nav__link"> |
| 573 | + <a href="#3-set-the-target-connection" class="md-nav__link"> |
550 | 574 | <span class="md-ellipsis"> |
551 | | - 3. Run the deploy on the remote environment |
| 575 | + 3. Set the target connection |
552 | 576 | </span> |
553 | 577 | </a> |
554 | 578 |
|
| 579 | +</li> |
| 580 | + |
| 581 | + <li class="md-nav__item"> |
| 582 | + <a href="#4-run-the-deployment" class="md-nav__link"> |
| 583 | + <span class="md-ellipsis"> |
| 584 | + 4. Run the deployment |
| 585 | + </span> |
| 586 | + </a> |
| 587 | + |
| 588 | + <nav class="md-nav" aria-label="4. Run the deployment"> |
| 589 | + <ul class="md-nav__list"> |
| 590 | + |
| 591 | + <li class="md-nav__item"> |
| 592 | + <a href="#do-i-need-network" class="md-nav__link"> |
| 593 | + <span class="md-ellipsis"> |
| 594 | + 🤔 Do I need --network? |
| 595 | + </span> |
| 596 | + </a> |
| 597 | + |
| 598 | +</li> |
| 599 | + |
| 600 | + </ul> |
| 601 | + </nav> |
| 602 | + |
555 | 603 | </li> |
556 | 604 |
|
557 | 605 | </ul> |
@@ -607,12 +655,30 @@ <h3 id="2-build-the-image">2. Build the image</h3> |
607 | 655 | <p>Then push it to your container registry:</p> |
608 | 656 | <div class="highlight"><pre><span></span><code>docker<span class="w"> </span>push<span class="w"> </span>ghcr.io/your-org/iko-with-migrations:latest |
609 | 657 | </code></pre></div> |
610 | | -<h3 id="3-run-the-deploy-on-the-remote-environment">3. Run the deploy on the remote environment</h3> |
611 | | -<p>On the target server or inside your CI/CD pipeline, run:</p> |
| 658 | +<h3 id="3-set-the-target-connection">3. Set the target connection</h3> |
| 659 | +<p>Iko uses the <code>SQITCH_TARGET</code> environment variable to connect to your database.</p> |
| 660 | +<p>For example:</p> |
| 661 | +<div class="highlight"><pre><span></span><code><span class="nb">export</span><span class="w"> </span><span class="nv">SQITCH_TARGET</span><span class="o">=</span>db:pg://admin:secret@your-database-host/app |
| 662 | +</code></pre></div> |
| 663 | +<p>Alternatively, set it in your CI/CD system’s environment configuration.</p> |
| 664 | +<blockquote> |
| 665 | +<p>🛡️ Do not hardcode credentials into your Dockerfile or image. Use CI secrets |
| 666 | +or -e flags instead.</p> |
| 667 | +</blockquote> |
| 668 | +<h3 id="4-run-the-deployment">4. Run the deployment</h3> |
| 669 | +<p>From your CI/CD pipeline or target server, run:</p> |
| 670 | +<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>run<span class="w"> </span>--rm<span class="w"> </span><span class="se">\</span> |
| 671 | +<span class="w"> </span>ghcr.io/your-org/iko-with-migrations:latest<span class="w"> </span>deploy<span class="w"> </span>--verify |
| 672 | +</code></pre></div> |
| 673 | +<h4 id="do-i-need-network">🤔 Do I need --network?</h4> |
| 674 | +<p>Only if your Postgres instance is running in Docker on the same machine.</p> |
| 675 | +<p>If so, and it's in a custom Docker network, use:</p> |
612 | 676 | <div class="highlight"><pre><span></span><code>docker<span class="w"> </span>run<span class="w"> </span>--rm<span class="w"> </span><span class="se">\</span> |
613 | | -<span class="w"> </span>-e<span class="w"> </span><span class="nv">PG_URI</span><span class="o">=</span>pg://user:pass@postgres/app<span class="w"> </span><span class="se">\</span> |
| 677 | +<span class="w"> </span>--network<span class="w"> </span>your-network<span class="w"> </span><span class="se">\</span> |
614 | 678 | <span class="w"> </span>ghcr.io/your-org/iko-with-migrations:latest<span class="w"> </span>deploy<span class="w"> </span>--verify |
615 | 679 | </code></pre></div> |
| 680 | +<p>Otherwise, for hosted databases (RDS, Cloud SQL, etc.) or Postgres installed on |
| 681 | +the host system, you don’t need a custom Docker network.</p> |
616 | 682 |
|
617 | 683 |
|
618 | 684 |
|
|
0 commit comments