mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 17:14:08 +02:00
office wip
This commit is contained in:
parent
90c54b6b1c
commit
cc2a5ca899
4 changed files with 132 additions and 2 deletions
|
|
@ -18,7 +18,10 @@ RUN DEBIAN_FRONTEND=noninteractive ;\
|
||||||
sqlite3 \
|
sqlite3 \
|
||||||
s3cmd \
|
s3cmd \
|
||||||
gdb \
|
gdb \
|
||||||
python3-pip && \
|
python3-pip \
|
||||||
|
procps \
|
||||||
|
ncat \
|
||||||
|
chromium && \
|
||||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.1.35.zip" -o "awscliv2.zip" && \
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.1.35.zip" -o "awscliv2.zip" && \
|
||||||
unzip awscliv2.zip && \
|
unzip awscliv2.zip && \
|
||||||
./aws/install && \
|
./aws/install && \
|
||||||
|
|
@ -29,11 +32,13 @@ RUN DEBIAN_FRONTEND=noninteractive ;\
|
||||||
wget https://github.com/vimeo/psalm/releases/latest/download/psalm.phar -O /usr/local/bin/psalm && \
|
wget https://github.com/vimeo/psalm/releases/latest/download/psalm.phar -O /usr/local/bin/psalm && \
|
||||||
chmod +x /usr/local/bin/psalm
|
chmod +x /usr/local/bin/psalm
|
||||||
|
|
||||||
|
ADD misc/collaboraonline.sources /etc/apt/sources.list.d
|
||||||
RUN DEBIAN_FRONTEND=noninteractive ;\
|
RUN DEBIAN_FRONTEND=noninteractive ;\
|
||||||
wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add - && \
|
wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add - && \
|
||||||
echo "deb http://packages.blackfire.io/debian any main" >> /etc/apt/sources.list.d/blackfire.list && \
|
echo "deb http://packages.blackfire.io/debian any main" >> /etc/apt/sources.list.d/blackfire.list && \
|
||||||
|
wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg -O /usr/share/keyrings/collaboraonline-release-keyring.gpg && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install --assume-yes blackfire procps ncat chromium
|
apt-get install --assume-yes blackfire
|
||||||
|
|
||||||
ADD configs/autoconfig_mariadb.php configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/s3mb.php configs/swift.php configs/swiftv3.php configs/azure.php configs/config.php /root/
|
ADD configs/autoconfig_mariadb.php configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/s3mb.php configs/swift.php configs/swiftv3.php configs/azure.php configs/config.php /root/
|
||||||
ADD configs/nginx-app.conf /etc/nginx/
|
ADD configs/nginx-app.conf /etc/nginx/
|
||||||
|
|
|
||||||
4
images/haze/misc/collaboraonline.sources
Normal file
4
images/haze/misc/collaboraonline.sources
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Types: deb
|
||||||
|
URIs: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-debian11
|
||||||
|
Suites: ./
|
||||||
|
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg
|
||||||
|
|
@ -2,6 +2,7 @@ mod clam;
|
||||||
mod kaspersky;
|
mod kaspersky;
|
||||||
mod ldap;
|
mod ldap;
|
||||||
mod objectstore;
|
mod objectstore;
|
||||||
|
mod office;
|
||||||
mod onlyoffice;
|
mod onlyoffice;
|
||||||
mod push;
|
mod push;
|
||||||
mod smb;
|
mod smb;
|
||||||
|
|
@ -11,6 +12,7 @@ pub use crate::service::clam::ClamIcap;
|
||||||
use crate::service::kaspersky::{Kaspersky, KasperskyIcap};
|
use crate::service::kaspersky::{Kaspersky, KasperskyIcap};
|
||||||
pub use crate::service::ldap::{LDAPAdmin, LDAP};
|
pub use crate::service::ldap::{LDAPAdmin, LDAP};
|
||||||
pub use crate::service::objectstore::ObjectStore;
|
pub use crate::service::objectstore::ObjectStore;
|
||||||
|
pub use crate::service::office::Office;
|
||||||
pub use crate::service::onlyoffice::OnlyOffice;
|
pub use crate::service::onlyoffice::OnlyOffice;
|
||||||
pub use crate::service::push::NotifyPush;
|
pub use crate::service::push::NotifyPush;
|
||||||
use crate::service::smb::Smb;
|
use crate::service::smb::Smb;
|
||||||
|
|
@ -74,6 +76,7 @@ pub enum Service {
|
||||||
LDAP(LDAP),
|
LDAP(LDAP),
|
||||||
LDAPAdmin(LDAPAdmin),
|
LDAPAdmin(LDAPAdmin),
|
||||||
OnlyOffice(OnlyOffice),
|
OnlyOffice(OnlyOffice),
|
||||||
|
Office(Office),
|
||||||
Push(NotifyPush),
|
Push(NotifyPush),
|
||||||
Smb(Smb),
|
Smb(Smb),
|
||||||
Kaspersky(Kaspersky),
|
Kaspersky(Kaspersky),
|
||||||
|
|
@ -88,6 +91,7 @@ impl Service {
|
||||||
"s3mb" => Some(&[Service::ObjectStore(ObjectStore::S3mb)]),
|
"s3mb" => Some(&[Service::ObjectStore(ObjectStore::S3mb)]),
|
||||||
"ldap" => Some(&[Service::LDAP(LDAP), Service::LDAPAdmin(LDAPAdmin)]),
|
"ldap" => Some(&[Service::LDAP(LDAP), Service::LDAPAdmin(LDAPAdmin)]),
|
||||||
"onlyoffice" => Some(&[Service::OnlyOffice(OnlyOffice)]),
|
"onlyoffice" => Some(&[Service::OnlyOffice(OnlyOffice)]),
|
||||||
|
"office" => Some(&[Service::Office(Office)]),
|
||||||
"push" => Some(&[Service::Push(NotifyPush)]),
|
"push" => Some(&[Service::Push(NotifyPush)]),
|
||||||
"smb" => Some(&[Service::Smb(Smb)]),
|
"smb" => Some(&[Service::Smb(Smb)]),
|
||||||
"kaspersky" => Some(&[Service::Kaspersky(Kaspersky)]),
|
"kaspersky" => Some(&[Service::Kaspersky(Kaspersky)]),
|
||||||
|
|
|
||||||
117
src/service/office.rs
Normal file
117
src/service/office.rs
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
use crate::config::HazeConfig;
|
||||||
|
use crate::image::pull_image;
|
||||||
|
use crate::service::ServiceTrait;
|
||||||
|
use crate::Result;
|
||||||
|
use bollard::container::{Config, CreateContainerOptions, NetworkingConfig};
|
||||||
|
use bollard::models::{ContainerState, EndpointSettings, HostConfig};
|
||||||
|
use bollard::Docker;
|
||||||
|
use maplit::hashmap;
|
||||||
|
use miette::{IntoDiagnostic, Report};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||||
|
pub struct Office;
|
||||||
|
|
||||||
|
#[async_trait::async_trait]
|
||||||
|
impl ServiceTrait for Office {
|
||||||
|
fn name(&self) -> &str {
|
||||||
|
"office"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn env(&self) -> &[&str] {
|
||||||
|
&["COOL_HOST=office"]
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn spawn(
|
||||||
|
&self,
|
||||||
|
docker: &Docker,
|
||||||
|
cloud_id: &str,
|
||||||
|
network: &str,
|
||||||
|
_config: &HazeConfig,
|
||||||
|
) -> Result<String> {
|
||||||
|
let image = "collabora/code";
|
||||||
|
pull_image(docker, image).await?;
|
||||||
|
let options = Some(CreateContainerOptions {
|
||||||
|
name: self.container_name(cloud_id),
|
||||||
|
});
|
||||||
|
let config = Config {
|
||||||
|
image: Some(image),
|
||||||
|
env: Some(vec!["extra_params=--o:ssl.enable=false"]),
|
||||||
|
host_config: Some(HostConfig {
|
||||||
|
network_mode: Some(network.to_string()),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
labels: Some(hashmap! {
|
||||||
|
"haze-type" => self.name(),
|
||||||
|
"haze-cloud-id" => cloud_id
|
||||||
|
}),
|
||||||
|
networking_config: Some(NetworkingConfig {
|
||||||
|
endpoints_config: hashmap! {
|
||||||
|
network => EndpointSettings {
|
||||||
|
aliases: Some(vec![self.name().to_string()]),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
let id = docker
|
||||||
|
.create_container(options, config)
|
||||||
|
.await
|
||||||
|
.into_diagnostic()?
|
||||||
|
.id;
|
||||||
|
docker
|
||||||
|
.start_container::<String>(&id, None)
|
||||||
|
.await
|
||||||
|
.into_diagnostic()?;
|
||||||
|
Ok(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn container_name(&self, cloud_id: &str) -> String {
|
||||||
|
format!("{}-office", cloud_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn apps(&self) -> &'static [&'static str] {
|
||||||
|
&["richdocuments"]
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn post_setup(&self, docker: &Docker, cloud_id: &str) -> Result<Vec<String>> {
|
||||||
|
let info = docker
|
||||||
|
.inspect_container(&self.container_name(cloud_id), None)
|
||||||
|
.await
|
||||||
|
.into_diagnostic()?;
|
||||||
|
let ip = if matches!(
|
||||||
|
info.state,
|
||||||
|
Some(ContainerState {
|
||||||
|
running: Some(true),
|
||||||
|
..
|
||||||
|
})
|
||||||
|
) {
|
||||||
|
info.network_settings
|
||||||
|
.unwrap()
|
||||||
|
.networks
|
||||||
|
.unwrap()
|
||||||
|
.values()
|
||||||
|
.next()
|
||||||
|
.unwrap()
|
||||||
|
.ip_address
|
||||||
|
.clone()
|
||||||
|
.unwrap()
|
||||||
|
} else {
|
||||||
|
return Err(Report::msg("office not started"));
|
||||||
|
};
|
||||||
|
Ok(vec![
|
||||||
|
format!(
|
||||||
|
r#"occ config:app:set richdocuments wopi_url --value="http://{}:9980""#,
|
||||||
|
ip
|
||||||
|
),
|
||||||
|
format!(
|
||||||
|
r#"occ config:app:set richdocuments public_wopi_url --value="http://{}:9980""#,
|
||||||
|
ip
|
||||||
|
),
|
||||||
|
format!(
|
||||||
|
r#"occ config:app:set richdocuments wopi_root --value="http://{}""#,
|
||||||
|
cloud_id
|
||||||
|
),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue