In my nodjs/a,gular2 project, I am trying to run locally the build-sot process as a local task, before deploying it , but I cannot get it right , how can I set it :
task :build_production_aot do
run_locally do
set :local_app_path, Dir.pwd
set :local_client_path, "#{fetch(:local_app_path)}/client"
sh 'npm run build:prod-aot'
end
end
thanks for feedback
UPDATE
succeeded in running the following task , but is there any better way to write it ?
task :build_production_aot do
run_locally do
local_client_path = Dir.pwd + "/client"
puts "--> Running build: '#{local_client_path}', please wait ..."
execute "cd #{local_client_path} && npm run build:prod-aot"
end
end
thanks
Even if it runs locally with such modified script, I guess it's better to build the production dist directly on the remote server
Related
I need to setup ddev with TYPO3 10.4 on public server (I know it's not a good practise, it's just to show a demo to the client). On my local machine (Windows + WSL2 + Docker + DDEV + Composer) everything works perfect, but when I start my project on the Linux suddenly there are some errors.
I have checked permissions, there is a newest version of composer, docker and ddev installed.
Errors:
[ Error ]
Call to undefined function Composer\Autoload\includeFile()
Failed to execute command vendor/bin/typo3cms extension:activate site: exit status 1
Task failed: Exec command 'cd frontend && npm ci && npm run prod' in container/service 'web': exit status 130
Task failed: Exec command 'vendor/bin/typo3cms database:updateschema' in container/service 'web': exit status 1
It looks like it can't execute commands, but I can't find any meaningful reason why. I will be glad for any ideas.
You need to install most new version of typo3-console.
Your problem is described here:
https://github.com/TYPO3-Console/TYPO3-Console/issues/1081
I'm running my e2e tests with Nightwatch.js. I want them to run with a bash script (with the end result of them running in CI).
I am pretty new to bash and here is what i have so far:
#!/bin/bash
# exit on errors
set -e
export NODE_ENV=development
export LIVERELOAD_DISABLED=YES
npm install
NODE_ENV=e2e grunt build
echo "...Starting Node App"
#start app in the background
NODE_ENV=e2e node server.js &
#save node app process id
NODE_PROC=$!
#wait a bit
sleep 10
echo "...Running Frontend Tests"
NODE_ENV=e2e npm run nightwatch
echo "...Tests Finished... Killing Node App"
kill -9 $NODE_PROC
echo "...Node App Killed"
the problem is that the script gets stuck after running all the tests (line: NODE_ENV=e2e npm run nightwatch)
the only output i'm getting are the logs and the usual tests output. The script gets stuck no matter if the tests pass, fail, or some do and some don't.
I've tried adding exit 0 at the end which didn't work (makes sense, since it doesn't execute to that point).
Also, changing set -e to set -ex didn't change the output.
what am i missing here?
So i was looking in the wrong place, the script is completely fine, the issue was that i did not close the connection to the DB inside the tests.
Not sure why that caused the issue, but it fixed it
I have a nodejs application that I've built/packaged via teamcity as well as deploy to one of our servers (which has node installed) through the Octopus deploy portal.
Everything works ok until i come to the post deploy powershell script from within octopus.
In one of the code blocks I have npm commands that throws an error npm not recognised.When I run the power-shell scripts on the server, everything works but when I try to run this via the octopus post deploy script I get the error as stated above.
I know that node /npm are installed and that the environment variables re:nodejs is set correctly, unless there is something else i'm missing , it still isn't working.
a simple pseudo-code of what i'm trying to do is this:
$deploymentDir = 'D:\Apps\<appname>\<octopus-version-number>'
$name = "service"
cd $deploymentDir
if($name){
Write-Host "link node-windows..."
npm link node-windows //node-windows is installed globally
}
else{
}
Unless there is something I'm missing , how can I get this to run via octopus ?
There is a possibility that Octopus master/tentacle service runs on different user, check the environment variable for that user also.
If you unable to find the root cause, the alternate is define one Target scoped variable called "npmPath" ( value may be different based on target ) in octopus to store npm path
Now, you can use $npmPath variable in script.
I am running my node.js application exe file on windows 7/10 startup. It is working fine but some cases my exe stops working and is closed automatically. I want to create some scheduled job for checking whether my exe is running or not. If not running start the application and if running do nothing.
Please guide me to create this kind of schedule job with 10 minutes.
#ECHO OFF
tasklist | find /i "app.exe" && echo process Already running || START "app.exe" "path"
create batch file using above code and use task scheduler for monitoring the exe is running
I run into a weird issue with capistrano 3 and brunch.
I want to execute brunch on remote server but nothing happen. My custom remote task looks like this:
namespace :brunch do
desc "Building assets with brunch.io"
task :build do
on roles(:web) do
within "#{release_path}" do
execute "node #{release_path}/node_modules/brunch/bin/brunch build --env=#{fetch(:stage)} #{release_path}"
end
end
end
end
When I run "cap staging deploy", I can see command is executed:
INFO [a246858c] Running node /releases/20160303145521/node_modules/brunch/bin/brunch build --env=staging /releases/20160303145521 as web
INFO [a246858c] Finished in 0.159 seconds with exit status 0 (successful).
But my assets are not built, nothing is done.
And if I connect on my server run command, everything works fine.
I don't understand this behaviour, is any one aware of that?
Thanks a lot for your help
I'm using Capistrano Version: 3.4.0 (Rake Version: 10.5.0)