Skip to content

Commit

Permalink
Add theia IDE support #831
Browse files Browse the repository at this point in the history
  • Loading branch information
fnoop committed Jan 21, 2020
1 parent 1584447 commit c601349
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 1 deletion.
7 changes: 6 additions & 1 deletion manifests/maverick-modules/maverick_web/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class maverick_web (
$cloud9 = true,
$cloud9 = false,
$codeserver = false,
$theia = false,
$nodejs = true,
$webserver = true,
$webserver_type = "nginx",
Expand Down Expand Up @@ -44,6 +45,10 @@
class { "maverick_web::codeserver": }
}

if $theia == true {
class { "maverick_web::theia": }
}

file { [ "/srv/maverick/data/web", "/srv/maverick/config/web", "/srv/maverick/var/log/web", "/srv/maverick/var/lib/web", ]:
ensure => directory,
owner => "mav",
Expand Down
59 changes: 59 additions & 0 deletions manifests/maverick-modules/maverick_web/manifests/theia.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
class maverick_web::theia (
$active = true,
$webport = "6789",
$basepath = "/srv/maverick",
$password = "wingman",
) {

ensure_packages(["libx11-dev", "libxkbfile-dev"])
if ! ("install_flag_theia" in $installflags) {
oncevcsrepo { "git-theia":
gitsource => "https://github.com/eclipse-theia/theia",
dest => "/srv/maverick/software/theia",
} ->
exec { "theia-build":
path => ["/bin", "/usr/bin", "/opt/nodejs/bin"],
command => "yarn >/srv/maverick/var/log/build/theia.build.log 2>&1",
cwd => "/srv/maverick/software/theia",
creates => "/srv/maverick/software/theia/examples/api-samples/lib/browser/api-samples-contribution.js",
require => [ Package['yarn'], Package["libx11-dev"], Package["libxkbfile-dev"] ],
timeout => 0,
user => "mav",
}
}

if defined(Class["::maverick_security"]) {
maverick_security::firewall::firerule { "theia":
ports => $webport,
ips => lookup("firewall_ips"),
proto => "tcp"
}
}

# Control running service
if $active == true {
$_ensure = running
$_enable = true
} else {
$_ensure = stopped
$_enable = false
}
file { "/etc/systemd/system/maverick-theia.service":
content => template("maverick_web/theia.service.erb"),
owner => "root",
group => "root",
mode => "644",
notify => [ Exec["maverick-systemctl-daemon-reload"], Service["maverick-theia"] ],
} ->
service { "maverick-theia":
ensure => $_ensure,
enable => $_enable,
}

# status.d entry
file { "/srv/maverick/software/maverick/bin/status.d/120.web/102.theia.status":
owner => "mav",
content => "theia,Theia IDE\n",
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Theia IDE
After=network-online.target
Requires=network-online.target

[Service]
TimeoutStartSec=0
WorkingDirectory=/srv/maverick/software/theia/examples/browser
ExecStart=/usr/bin/yarn run start --port <%= @webport %> --hostname 0.0.0.0
User=mav

[Install]
WantedBy=multi-user.target

0 comments on commit c601349

Please sign in to comment.