Skip to content

Commit

Permalink
infra: networking fixes (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
brokad authored Oct 8, 2022
1 parent c7d2c13 commit 893d074
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
21 changes: 20 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
version: "3.5"
version: "3.7"
volumes:
gateway-vol:
postgres-vol:
networks:
user-net:
driver: overlay
attachable: true
ipam:
driver: default
config:
- subnet: 10.99.0.0/24
services:
gateway:
image: "${CONTAINER_REGISTRY}/gateway:${BACKEND_TAG}"
Expand All @@ -19,6 +23,13 @@ services:
condition: on-failure
delay: 5s
max_attempts: 3
update_config:
order: start-first
failure_action: rollback
delay: 10s
rollback_config:
parallelism: 0
order: stop-first
placement:
constraints:
- node.hostname==controller
Expand All @@ -39,6 +50,7 @@ services:
- "--image=${CONTAINER_REGISTRY}/deployer:${BACKEND_TAG}"
- "--prefix=shuttle_"
- "--network-name=${STACK}_user-net"
- "--docker-host=/var/run/docker.sock"
- "--provisioner-host=provisioner"
- "--proxy-fqdn=${APPS_FQDN}"
healthcheck:
Expand All @@ -61,6 +73,13 @@ services:
condition: on-failure
delay: 5s
max_attempts: 3
update_config:
order: start-first
failure_action: rollback
delay: 10s
rollback_config:
parallelism: 0
order: stop-first
placement:
constraints:
- node.hostname==provisioner
Expand Down
3 changes: 3 additions & 0 deletions gateway/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub struct StartArgs {
/// the provisioner service
#[arg(long, default_value = "provisioner")]
pub provisioner_host: String,
/// The path to the docker daemon socket
#[arg(long, default_value = "/var/run/docker.sock")]
pub docker_host: String,
/// The Docker Network name in which to deploy user runtimes
#[arg(long, default_value = "shuttle_default")]
pub network_name: String,
Expand Down
4 changes: 2 additions & 2 deletions gateway/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use axum::headers::{Authorization, HeaderMapExt};
use axum::http::Request;
use axum::response::Response;
use bollard::network::ListNetworksOptions;
use bollard::Docker;
use bollard::{Docker, API_DEFAULT_VERSION};
use hyper::client::connect::dns::GaiResolver;
use hyper::client::HttpConnector;
use hyper::Client;
Expand Down Expand Up @@ -182,7 +182,7 @@ impl GatewayService {
/// * `args` - The [`Args`] with which the service was
/// started. Will be passed as [`Context`] to workers and state.
pub async fn init(args: StartArgs, fqdn: String, db: SqlitePool) -> Self {
let docker = Docker::connect_with_local_defaults().unwrap();
let docker = Docker::connect_with_unix(&args.docker_host, 60, API_DEFAULT_VERSION).unwrap();

let container_settings = ContainerSettings::builder(&docker, fqdn)
.from_args(&args)
Expand Down

0 comments on commit 893d074

Please sign in to comment.