我有一个程序,它取决于服务器上可用的static
和config
目录以及二进制文件。 NixOps的默认构建阶段不包括这些文件,据我所知它只是编译二进制文件然后将二进制文件复制到服务器。
如何修改构建阶段,以便服务器上可以使用static
和config
目录?我尝试添加:
preInstall = ''
echo "copying static and config files"
cp -a ../static $out/static
cp -a ../config $out/config
'';
但这似乎并没有实际复制文件,我从未看到echo
命令被执行。 Here是NixOps使用的配置文件的要点。服务器上的错误是:
[root@pprjam:~]# systemctl status pprjam
● pprjam.service - pprjam webapp
Loaded: loaded (/nix/store/z2s52f39p3dx8q9b06rkaqqw5mhdvnmq-unit-pprjam.service/pprjam.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2018-02-17 01:29:57 UTC; 1min 27s ago
Process: 6917 ExecStart=/nix/store/khilhwldcbm0xm3a3bzhy6f0kwdk8w1p-pprjam-0.0.0/bin/pprjam (code=exited, status=1/FAILURE)
Main PID: 6917 (code=exited, status=1/FAILURE)
Feb 17 01:29:51 pprjam systemd[1]: Started pprjam webapp.
Feb 17 01:29:56 pprjam pprjam[6917]: pprjam: static: getDirectoryContents:openDirStream: does not exist (No such file or directory)
Feb 17 01:29:57 pprjam systemd[1]: pprjam.service: Main process exited, code=exited, status=1/FAILURE
Feb 17 01:29:57 pprjam systemd[1]: pprjam.service: Unit entered failed state.
Feb 17 01:29:57 pprjam systemd[1]: pprjam.service: Failed with result 'exit-code'.