It seems that the stock bootstrapping process is a bit lacking on Windows.
Linux has cloud-init which will install packages, store files, and run a bash script from user data.
Windows has ec2config but there is currently no support to run a cmd or powershell script when the system is "ready"--meaning that all the initial reboots are completed.
There seem to be third party options. For example RightScale has the RightLink agent which performs this function.
Are there open source options available?
Are there any plans to add this feature to Ec2Config?
Do I have to build this my self?
Am I missing something?
It appears that EC2Config on the Amazon-provided AMIs now supports "User Data Scripts" as of the 11-April-2012 updates.
The documentation has not yet been updated, so it's hard to tell if it supports PowerShell or just cmd.exe scripts. I've posted a question on the AWS forums to try and get some more detail, and will update here when I learn more.
UPDATE: It looks like cmd.exe batch syntax is supported, which can in turn invoke PowerShell. There's a new version of the EC2Config documentation included on the AMI. Quoting from it:
[EC2Config] will read in the user data specified for the instance and then check if it contain the tags <script> and </script>. If it finds both then it will take the information between those two tags and save it to a batch file located in the Settings folder of this application. It will then execute the batch file during the start of an instance.
The batch file will only be created and executed on the first launch of an instance after a sysprep. If you want to have the batch file created and executed again set the Ec2HandleUserdata plugin state to Enabled.
UPDATE 2: My interpretation is confirmed by Shon from the AWS Team
UPDATE 3: And as of the May-2012 AMIs, PowerShell is supported using the <powershell/> tag.
Cloudbase.it have opensourced a python windows service they call cloudbase-init which follows the configdrive and HTTP datasources.
http://www.cloudbase.it/cloud-init-for-windows-instances/
github here
https://github.com/stackforge/cloudbase-init/
I had to build one myself however it was very easy. Just made a service that reads the user-data when starts up and executes the file as a powershell script.
To get around the issue of not knowing when to start the service I just made the service start type as "delayed-auto" and that seemed to fix the problem. Depending on what you need to do to the system that may or may not work for you however in my case that was all I had to do.
I added a new codeplex project that already has this tool built for windows. Looking forward to some feedback.
http://cloudinitnet.codeplex.com/
We had to build it ourselves; we did it with a custom service and built our own AMIs. There's no provision currently within EC2Config to do it.
Even better, there is no easy way to determine when the instance is "ready". We had to do it by tailing the logfile of EC2Config.
I've recently found nssm (at nssm.cc) which easily wraps a simple batch file (or pretty much anything else) as a service. You can then us sc config servic1 depend= service0 to force the batch file to be run at a particular point in the service initialization sequence. I am using it in between ex2config and sql express to create a folder on d, for instance. You'll have to use the services tool to make it run as network services and change the AppExit property to Ignore using regedit, but it works once you get it all in place.
Related
I've created a windows service application and I'm working on the installer for this service application at the moment, as there's lots of user options that need defining.
Previously when I needed to create a service I've just created a .bat file containing a relevant SC Create command in temp and executed it to add my service, however I wondered if there's a way to add the service directly rather than creating and executing a bat file.
You don't need the temporary .bat file. You can run any command through Process.Start without a temporary file.
Maybe you should think about your installer technology though. A VB.NET executable means people will have to run an installer for that first, then start it to have an installer for the service. I would be slightly amused by having to install the installer.
Wix for example can build installer packages that install a service. Other alternatives are out there too (but this one is free).
They might be quite obscure: i enjoy RazorSQL for all it can do, and it is the only tool i found that talks properly is Clarions's ODBC driver. It also allows for awesome command line calls to export data.
Trouble is: RazorSQL stores profile connection information based on the user that installed it, and when you set a Windows task to run the batch files of all the groovy export commands, the internal batch file fail without external notification because the user is SYSTEM (as we don't want this tied to any one user)..
I do not recall if there was an option on install allowing profiles to be seen by all, as i normally set this to everyone on my dev box (as it is only me).
So the question: has anyone encountered this obscure scenario, and knows how to have RazorSQL look in a generic location for connection details?
RazorSQL checks for system property named "razorPortable". When defined with a value of "portable" it keeps all its stuff in a RazorSQL folder under its main directory, so shared by all users launching it with said property defined.
So you know the drill: edit some of the bundled bat files and add -DrazorPortable=portable to the command line.
You'll need to re-enter yout registration code, connection profiles, preferences, etc. Or you can manually move them.
Is there a possibility to deploy or redeploy a SAS job (Data Integration Studio) via a shell script ?
Also is there a way to create its SPK file via script ?
You can deploy DI jobs from commandline, see here:
http://support.sas.com/documentation/cdl/en/etlug/65807/HTML/default/viewer.htm#p1jxhqhaz10gj2n1pyr0hbzozv2f.htm
I have imported and exported objects into SAS DIS via shell script use this sas ExportPackage utility. I personally find it way more convenient as compared to window method. However, for it to work you need to have X-windows Environment, i used Xming for it.
As for deploying Jobs, never tried it.
To redeploy jobs DI Studio versions 4.901 and higher have a DepoyJobs tool which is designed to perform this function: read more in the SAS documentation. It is available on the server. Older versions had a similar but much more restrictive client tool using ant.
Also see Paper 1067-2017 An Introduction to the Improved SASĀ® Data Integration Studio Batch Deployment Utility on UNIX by Jeff Dyson, The Financial Risk Group, which gives a run through on how to use it.
I need to periodically distribute an updated set of files (DLL, javascript) as a patch release to multiple windows PCs of various versions (vista/XP/7 etc.). Currently I have a link on my website for each user to download the setup.exe file and manually install the patch (replaces the existing DLLs). In order to eliminate the manual process, I'm researching how to run a program automatically on windows (I assume that means a service) which will check my server periodically for an update, download it and automatically trigger the setup.exe (or some similar process to get the patch files replaced).
I'm not a windows developer per se, but have downloaded and tried to check various options (in order to not reinvent the wheel) such as Sparkle, DDay, CSAutoUpdater, Npackd and just started looking into Google Omaha - but most assume that check happens when the windows application is started using their libraries/components. I need to run an autoupdater independently of the app I'm trying to update - so I need to first get all users to run a setup.exe which should install and start my windows service so that it can run with windows daily to run a program to check, download and install the update.
I found some sample code for writing windows service on stackoverflow, codeproject also, but couldn't find how to autoinstall it (ideally with no UAC hassles for newer windows versions). All required using instalutil or some other manual process to install and start the service.
Any guidance on this would be great! Thanks - and apologies to the long winded question. Will update with additional results as I try out other products.
As you mentioned Npackd I would like to describe how this can be done using it.
I agree with selbie that the simplest solution would be to just create a task with Windows scheduler.
For Npackd you would need your own repository - an XML file accessible via HTTP, for example as http://www.yourserver.com/rep.xml . Here is a simple example for a repository: https://gist.github.com/raw/4132983/dabecde48c796d4fdfa2f645bb744ac58640572c/TestRepository.xml . A user would download Npackd (http://code.google.com/p/windows-package-manager/downloads/list) and add the URL to the list of repositories.
I would define 2 packages: one for the program itself and one for the auto-updater. This way if somebody wants to update the program manually, he can do this too.
You could create or delete a Windows task using the command line tool schtasks.exe available on every Windows system.
The update command itself would be also very simple:
npackdcl update --package=<package>
In order to eliminate the manual process, I'm researching how to run a program automatically on windows (I assume that means a service) which will check my server periodically for an update, download it and automatically trigger the setup.exe (or some similar process to get the patch files replaced).
You likely want the Windows Task Scheduler service for the "periodic" part of your statement. You use that to launch whatever code you would need to actually do the "check for update", download, copy, etc... I don't think you need a Windows Service.
You can likely script a Task Scheduler event. Or do it more programmatically with the API.
You can do as follow:
Maintain the version of the of the dll,exe etc in DB.
Check the version of the Installed version with the version in DB, before the application start up.
If the versions are diff, ask the user to update to the latest version from server.
If he clicks on YES. Update the files from server.
Prasad.
Is it possible to install the entire database(postgresql8.2) via command prompt or batch file or registry file bypassing the trivial procedure for installation. But then to a question comes that, how can we supply default parameters such as name,password,language,default location of database? Currently I'm working on 'Windows XP' platform.
Thank you.
For 8.3 and lower the obvious answer is: http://pginstaller.projects.pgfoundry.org/ which supports or supported silent installations. For more recent versions, please read: http://forums.enterprisedb.com/posts/list/2135.page
Use of existing installers would simplify your life and be where I would start.
This being said there is no reason you can't generate a script to register dll's properly run initdb, etc. This will take some extra knowledge of both PostgreSQL and Windows, and will be mostly suitable for custom solutions (i.e. not cases where you merely are packaging software that runs with PostgreSQL). I don't think an complete answer can be given here because once you need such a solution you need to design your installation around if. Books could be written on that topic. The docs http://www.postgresql.org/docs/9.0/static/install-windows.html should get you started however since the only difference really between installing from source and installing from the precompiled source is just that you need to compile the source files first.
Failing that you could take a look at the binary zip packages. Typically these can be extracted and PostgreSQL can be run from inside them.