A focused Docker Compose management web application.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add redeploy/pull/build

Brooke e49fedb0 e3f1a0b9

+111 -1
+72
packages/node/src/api/action.rs
··· 77 77 .await?; 78 78 return Ok(().into()); 79 79 } 80 + 81 + /// Redeploys the given project and all its services. 82 + #[endpoint] 83 + pub async fn redeploy_project(project: PathParam<String>, depot: &mut Depot) -> LuminaryResponse<()> { 84 + let engine = obtain!(depot, LuminaryEngine); 85 + 86 + engine.redeploy(&project.into_inner(), None).await?; 87 + return Ok(().into()); 88 + } 89 + 90 + /// Redeploys the given service of the project. 91 + #[endpoint] 92 + pub async fn redeploy_service( 93 + project: PathParam<String>, 94 + service: PathParam<String>, 95 + depot: &mut Depot, 96 + ) -> LuminaryResponse<()> { 97 + let engine = obtain!(depot, LuminaryEngine); 98 + 99 + engine 100 + .redeploy(&project.into_inner(), Some(&service.into_inner())) 101 + .await?; 102 + return Ok(().into()); 103 + } 104 + 105 + /// Pulls the images for all the services in the given project. 106 + #[endpoint] 107 + pub async fn pull_project(project: PathParam<String>, depot: &mut Depot) -> LuminaryResponse<()> { 108 + let engine = obtain!(depot, LuminaryEngine); 109 + 110 + engine.pull(&project.into_inner(), None).await?; 111 + return Ok(().into()); 112 + } 113 + 114 + /// Pulls the images for the given service of the project. 115 + #[endpoint] 116 + pub async fn pull_service( 117 + project: PathParam<String>, 118 + service: PathParam<String>, 119 + depot: &mut Depot, 120 + ) -> LuminaryResponse<()> { 121 + let engine = obtain!(depot, LuminaryEngine); 122 + 123 + engine 124 + .pull(&project.into_inner(), Some(&service.into_inner())) 125 + .await?; 126 + return Ok(().into()); 127 + } 128 + 129 + /// Builds the images for all the services in the given project. 130 + #[endpoint] 131 + pub async fn build_project(project: PathParam<String>, depot: &mut Depot) -> LuminaryResponse<()> { 132 + let engine = obtain!(depot, LuminaryEngine); 133 + 134 + engine.build(&project.into_inner(), None).await?; 135 + return Ok(().into()); 136 + } 137 + 138 + /// Builds the images for the given service of the project. 139 + #[endpoint] 140 + pub async fn build_service( 141 + project: PathParam<String>, 142 + service: PathParam<String>, 143 + depot: &mut Depot, 144 + ) -> LuminaryResponse<()> { 145 + let engine = obtain!(depot, LuminaryEngine); 146 + 147 + engine 148 + .build(&project.into_inner(), Some(&service.into_inner())) 149 + .await?; 150 + return Ok(().into()); 151 + }
+7 -1
packages/node/src/api/mod.rs
··· 74 74 .push(Router::with_path("restart").post(action::restart_project)) 75 75 .push(Router::with_path("start").post(action::start_project)) 76 76 .push(Router::with_path("stop").post(action::stop_project)) 77 + .push(Router::with_path("redeploy").post(action::redeploy_project)) 78 + .push(Router::with_path("pull").post(action::pull_project)) 79 + .push(Router::with_path("build").post(action::build_project)) 77 80 .push( 78 81 Router::with_path("service/{service}") 79 82 .push(Router::with_path("restart").post(action::restart_service)) 80 83 .push(Router::with_path("start").post(action::start_service)) 81 - .push(Router::with_path("stop").post(action::stop_service)), 84 + .push(Router::with_path("stop").post(action::stop_service)) 85 + .push(Router::with_path("redeploy").post(action::redeploy_service)) 86 + .push(Router::with_path("pull").post(action::pull_service)) 87 + .push(Router::with_path("build").post(action::build_service)), 82 88 ), 83 89 ), 84 90 ),
+31
packages/node/src/core/action.rs
··· 86 86 .await?; 87 87 Ok(()) 88 88 } 89 + 90 + #[wrap_err("Failed to redeploy project/service")] 91 + pub async fn redeploy(&self, project: &str, service: Option<&str>) -> Result<()> { 92 + self.stop(project, service).await?; 93 + self.start(project, service).await?; 94 + Ok(()) 95 + } 96 + 97 + /// Stops the given project and optionally, a specific service within that project. 98 + #[wrap_err("Failed to pull project/service images")] 99 + pub async fn pull(&self, project: &str, service: Option<&str>) -> Result<()> { 100 + self.run(LuminaryAction::Pulling, project, service, vec!["pull"]) 101 + .await?; 102 + self.redeploy(project, service).await?; 103 + Ok(()) 104 + } 105 + 106 + /// Stops the given project and optionally, a specific service within that project. 107 + #[wrap_err("Failed to build project/service images")] 108 + pub async fn build(&self, project: &str, service: Option<&str>) -> Result<()> { 109 + self.run( 110 + LuminaryAction::Building, 111 + project, 112 + service, 113 + vec!["build", "--no-cache"], 114 + ) 115 + .await?; 116 + 117 + self.redeploy(project, service).await?; 118 + Ok(()) 119 + } 89 120 }
+1
packages/node/src/core/model.rs
··· 162 162 Stopping, 163 163 Starting, 164 164 Pulling, 165 + Building, 165 166 } 166 167 167 168 /// Stores the log channel and buffer for a project.