Packer tool Provisioners Query - Executing Shell Script on Installed Packer Machine - packer

I have packer tool installed on Linux Machine. I am provisioning a Windows machine through this tool. I want to execute one shell script which will initiate a scan on provisioned VM in order to check the vulnerability. I added shell script in the provisioner section of the packer JSON and the shell script was working fine when I was provisioning Linux VM. Now I am facing issues while provisioning Windows VM. I don't want to write any powershell script in order to initiate the Scan. Is there any way to execute the shell script from the machine where packer is installed after windows VM gets provisioned. Any help would be appreciated.

You can use the shell-local provisioner to run tools on the Packer host. The only problem is to get the IP of the VM you want to scan. How to do that depends on which builder you are using.

Related

Do I need to compile my code on the ubuntu server?

When I run 'npm run build' in the vsCode terminal ,within a few seconds, it compiles. However, when I run 'npm run build' on the ubuntu 20.04 server after I've pulled my code from gihub, it takes hours and then never actually compiles. The reason is usually a memory leak, but I started increasing the memory allocation, and now the server disconnects before it ever finishes the build.
My app is a mern app, does anyone know if this is an issue with my code or is the issue that I don't need to build my app on the ubuntu server? For example could I build the app it vscode first, as that seems to work?
you don't need to build the app in ubuntu server in order to deploy the same. You can build your app anywhere and copy the content of the build folder to the server for deploying.

Windows Service installation on Docker Container

I am trying to port one of our Tomcat based Windows application to Windows Nano Server Container. The installation process includes two Windows Service installations - an ActiveMQ service and another Tomcat Service. This is achieved using two batch files provided with the product. In addition to installing the service, they also pass several arguments pertaining to JVM. Now the issue I am facing is I am not able to get these services installed on a Nano Server. The same Dockerfile works perfect and installs the product on Windows Server Core Container.
Observation: The services which get installed through batch files are dependent on two system components - Ancillary Function Driver for Winsock (Service name: afd) and TCP/IP Protocol Driver (Service Name: tcpip). This is something which I discovered on a VM where the product was installed when checking the service properties. I see that they are absent in a Nano Server Container but are present in Windows Server Core container. Could that be a reason? If yes, is there any way to get those services running on Nano Server?
I am at a loss on how to troubleshoot this issue. Are there any limitations on Nano Server Container when it comes to Windows Services?
Consider building your docker container from the ground up,
Determine and set your prerequisites
Install all of the dependencies first
Install the application and services in question
(For additional information you can look at this wiki page.)
The Nano server container is minimal and misses many windows default services, you’ll have to build most of them through Dockerfile yourself.
The easiest method will be to do this manually on Nano server and confirm everything to be working in the docker container/image, and then later generate an automated build.

How to install extension on server in yii2

I have an website running on server.
I want to use graph extension to show some reports.
How do install extension on server?
Locally I can use cmd for that, do I need to download project install extension and upload it again?
You have to enable SSH access on your server.
DigitalOcean SSH tutorial - here you can find some helpful informations about SSH connection.
If you connect by SSH, navigate to project directory and use composer install or composer update.
If you don't have a command line access to your server and so cannot use composer directly, I would recommend to do prepare the code locally in a 'deploy' folder and then copy the whole folder content, including the vendor directory, to the server. I assume that you can use composer locally, so that you can install the extension regularely . And I assume that the local machine and the server does differ to much (PHP version, other settings).
Installing the yii2-extension does mean: if you install it with composer install Yii gets prepared so that you can use the code like any other code in your application. Installing the extension creates an entry in `vendor/yiisoft/extension.php which gets evaluated each time the application gets loaded.

tcl failed to load package when remote desktop with root account

The OS is Ubuntu 12.04.
I have the tcl scripts to do some job, which require some package, as:
package require ParseConfig
If I run the scripts in this Ubuntu directly with root account, then the scripts could run well.
However, if I access the Ubuntu by remote desktop(by installing vncserver), then it will report:
Can't find package ParseConfig while executing "package require ParseConfig".
The account for the remote access is root too.

MySQL interfering with Intel TBB setup

I am installing intel TBB performance library. But before using it, I have to setup the environment variables. A script file is provided which automates this process. But when I try to run the .bat file in the command prompt saying mySQL is not a valid command (look at the screenshot). I don't know how MySQL came into the picture. How do I make the script file run properly.?
I am facing a similar problem when trying to set the environment variables for Intel IPP using a script file.