autodeploy add profiles
Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
parent
5aef6a6238
commit
a0ef3c9aa7
2 changed files with 44 additions and 1 deletions
31
yume-mods/misskey-auto-deploy/config.toml
Normal file
31
yume-mods/misskey-auto-deploy/config.toml
Normal file
|
@ -0,0 +1,31 @@
|
|||
[service]
|
||||
listen = "[::]:7070"
|
||||
|
||||
[auth]
|
||||
secret = "$2b$12$B7krtFJwRlxYVgUQT.9ZA.0CibHt31YKq1r47uXpLt4WVowjHtxnO"
|
||||
|
||||
[refs."develop"]
|
||||
ref = "refs/heads/develop"
|
||||
working_dir = "/var/lib/misskey/test0/yumechi-no-kuni"
|
||||
uid = 970
|
||||
gid = 968
|
||||
|
||||
[refs."develop".env]
|
||||
MISSKEY_UID = "970"
|
||||
MISSKEY_GID = "968"
|
||||
MTLS_REDIS_SNI = "redis.replicate.test0.mi.yumechi.jp"
|
||||
MTLS_POSTGRES_SNI = "psql.replicate.test0.mi.yumechi.jp"
|
||||
|
||||
|
||||
# [refs."main"]
|
||||
# ref = "refs/heads/main"
|
||||
# working_dir = "/var/lib/misskey/prod/yumechi-no-kuni"
|
||||
# uid = 971
|
||||
# gid = 968
|
||||
|
||||
# [refs."main".env]
|
||||
# MISSKEY_UID = "971"
|
||||
# MISSKEY_GID = "968"
|
||||
# MTLS_REDIS_SNI = "redis.replicate.mi.yumechi.jp"
|
||||
# MTLS_POSTGRES_SNI = "psql.replicate.mi.yumechi.jp"
|
||||
|
|
@ -49,6 +49,7 @@ pub struct RefConfig {
|
|||
pub stdout: Option<PathBuf>,
|
||||
pub stderr: Option<PathBuf>,
|
||||
pub working_dir: PathBuf,
|
||||
pub profiles: Option<Vec<String>>,
|
||||
pub compose_flags: Option<Vec<String>>,
|
||||
pub env: Option<HashMap<String, String>>,
|
||||
pub uid: u32,
|
||||
|
@ -200,6 +201,17 @@ impl App {
|
|||
|
||||
let mut command = Command::new("docker")
|
||||
.arg("compose")
|
||||
.args(
|
||||
matched_ref
|
||||
.config
|
||||
.profiles
|
||||
.as_ref()
|
||||
.map(|profiles|
|
||||
profiles.iter()
|
||||
.flat_map(|profiles| ["--profile", profiles.as_str()])
|
||||
.collect::<Vec<_>>())
|
||||
.unwrap_or(Vec::new()),
|
||||
)
|
||||
.arg("up")
|
||||
.arg("--detach")
|
||||
.arg("--build")
|
||||
|
@ -289,7 +301,7 @@ impl App {
|
|||
State(state): State<AppState>,
|
||||
Query(query): Query<GetStatusQuery>,
|
||||
) -> Result<Json<RefStatus>, ApiError> {
|
||||
let ref_ = match (&query.ref_, &query.branch) {
|
||||
let ref_ = match (query.ref_.as_ref(), query.branch.as_ref()) {
|
||||
(Some(ref_), None) => ref_.clone(),
|
||||
(None, Some(branch)) => format!("refs/heads/{}", branch),
|
||||
_ => {
|
||||
|
|
Loading…
Reference in a new issue