Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using Sparrow/Sparrowdo to deploy/configure crai instance #24

Open
melezhik opened this issue Apr 22, 2020 · 1 comment
Open

Comments

@melezhik
Copy link

melezhik commented Apr 22, 2020

Hi! I noticed that deploy logic is implemented via Nix expression language with a bit of Raku scenario . Is it intentionally?

I understand that pure declarative style is perfect for package build scenarios, but could be difficult for deployment/CM tasks.

Consider using Sparrowdo/Sparrow alternative. It seems we already have all the bits in place.

For example:

provision of crai instance

sparrowdo ---ssh_host=$cra_instance_ip --sparrowfile=deploy.raku

deploy.raku:

user "crai";

directory "/var/lib/crai", %(
  recursive => 1 ,
  owner => 'crai',
);

systemd-service "caddy", %(
  user => "crai",
  command => "$caddy/bin/caddy -conf $out/etc/Caddyfile"
);

service-start "caddy";
service-enable "caddy";

# So on, you got the idea

copy nix files over rsync

sparrowdo --localhost --nosudo --sparrowfile=copy-files.raku

copy-files.raku:

    # I could write a nice Sparrow task for nix-store queries too, 
   # so far  it's just a plain Raku:
    my @closure = run(<nix-store --query --requisites>,
                      $production, :out).out.lines;

    bash "rsync --archive --compress --ignore-existing --relative --verbose \\
     {@closure.join(' ')} \\
     root@$host:/";

It's just a thought, appreciate your feedback.

@melezhik
Copy link
Author

Hi @chloekek any updates here? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant