Spring XD - Unable to undeploy & destroy stream through --cmdfile option - spring-data

Today i have started automating certain Spring-XD tasks like, stream creation, deployment, and undeploying the same.
For this, all my undeploy and destroy commands sit in one file, but when i run the following
$xd-shell --cmdfile auto_cleanup_14032016_235706.txt
I'm getting the following output:
WARNING: Command 'stream destroy --name ingestion_14032016_235706_<>' was found but is not currently available (type 'help' then ENTER to learn about this command)
But When i run the same command inside the interactive shell xd-shell -- It seems to work fine. :(

You will notice this Warning when xd-shell fails to connect to Spring XD admin. Unless specified xd-shell assumes the admin server to be on localhost.
Add below statement to the top of your cmdfile.
admin config server http://spring-xd-admin-server:9393
Also provide the credentials to spring xd admin if required.

Related

How can I launch postgres server headless (without terminal) on Windows?

Using Postgres 9.5 and the libpqxx c++ bindings, I want to launch a copy of postgres that is not installed on the users machine, but is instead packaged up in my application directory.
Currently, I am using pg_ctl.exe to start and stop the server, however when we do this, pg_ctl.exe seems to launch postgres.exe in a new terminal window.
I want it to launch postgres.exe in a headless state, but can't work out how.
I have tried enabling/disabling the logging collector, setting the logging method to a csv file (instead of stdout/stderr), and a couple of other logging related things, but I don't think the issue is the logging.
I have also tried running postgres.exe manually (without pg_ctl) and can get that to run headless by spawning it as a background process and redirecting the logs, but I would prefer to use the "pg_ctl start" api for the "wait for startup" (-w), and "timeout" (-t) options that it provides.
I believe you won't be able to do that with pg_ctl.
It is perfectly fine to start PostgreSQL directly through the server executable postgres.exe. Alternatively, you can use pg_ctl register to create a service and start the service.
In my use case, I was able to resolve the issue by running pg_ctl.exe using
CreateProcess, and providing the dwCreationFlags CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW.
I was originally using CREATE_NEW_PROCESS_GROUP | DETACHED_PROCESS, but DETACHED_PROCESS still allowed a postgres terminal to appear. This is because DETACHED_PROCESS will spawn the pg_ctl without a console, but any process that inherits stdin/stdout from pg_ctl will try to use it's console, and since there isn't one, one will be spawned. CREATE_NO_WINDOW however will launch the process with a conhost.exe, however the console will have no window. When the executables spawned by pg_ctl try to write to the terminal, they will successfully write to the console created by the conhost.exe which has no window.
I am now able to run pg_ctl from code with no console appearing.

Not able to access Fuse Admin console

I have started server using fuse_home/bin/start. Server is appearing as started but not able to access Admin console.
It is showing hawtio screen instead.
Appreciate any direction.
Try creating a fabric first, by using the fabric:create command.
Fuse can be started in two ways one is using ./fuse script from bin dir
Another starting in background ./start and connect using ./client
./client connect to running fuse karaf console
[kkakarla#kkakarla bin]$ ./start
[kkakarla#kkakarla bin]$ ./status
Running ...
[kkakarla#kkakarla bin]$ ./client
Logging in as admin
Open a browser to http://localhost:8181 to access the management console
Create a new Fabric via 'fabric:create'
or join an existing Fabric via 'fabric:join [someUrls]'
Hit '' or 'osgi:shutdown' to shutdown JBoss Fuse.
JBossFuse:admin#root>
Please make sure you uncommented last line user.properties file before starting the fuse server. Fuse provides access to fuse management console using HOWTIO. Since you are starting fuse by using /.start you may not be able to create fabric directly until you connect to client, in that case you can connect to fuse server using SSH #localhost -p8101, then you can run fabric: create. Otherwise you can /.stop the server and start using ./fuse or ./karaf then you can run fabric commands directly. If still issue not resolved we have to check logs.

Ansible return status

I have an ansible playbook which deploys a jboss eap instance alongside some other things. The playbook runs fine until it gets to the point to start jboss using the provided standalone.sh script. I am using the shell module to start this script and it works fine in that jboss starts however when the task is executed ansible does not return any status message like a changed or OK and just seems to hang.
Is there a way I can force ansible to see this as something which has changed the system state ?
I don't personally use jboss, but this sounds to me like the startup.sh script simply isn't launching jboss in the background, so ansible is simply waiting for it to end and it never does.
There are a few potential ways you can address this. Given the information in this thread you might want to try a task like this:
- name: start jboss
shell: nohup standalone.sh > /dev/null
async: True
poll: 0
The poll: 0 tells Ansible to 'fire and forget' the command. If you don't include this then Ansible will kill the process when it returns from the remote server.
Another possibility is to use an init script. The thread I linked to above points to a location where you should be able to find an init script. You could install that (and leave it disabled if you don't want jboss to start up when the system reboots), and then simply run it via the service command from Ansible:
- name: start jboss
service: name=jboss state=started
Edit: If you're unwilling or unable to use nohup or an init script that puts jboss into the background then another alternative is to make use of screen if you have that installed and available to you. I regularly do this when invoking long-running commands from Ansible so that I can check back well after the playbook has been run to check on the status of the command:
- name: Invoke long running command
command: /usr/bin/screen -d -m /path/to/my/command
async: True
poll: 0
This will launch a detached screen session and invoke your command inside it. Ansible will promptly forget about it, leaving the command to run on its own.

Wildfly add-user.sh Instance to Management Instance

I'm running Wildfly within Docker. I need to add users and set the configuration before the java process is started.
I can run the add-user.sh script to create a simple user:
/wildfly/bin/add-user.sh admin admin --silent
However, I need to create a management user that will be used for authenticating an instance with the managed instance. In the CLI the option is:
"Is this new user going to be used for one AS process to connect to another AS process?", reply yes.
Is there a way to set this option via a parameter in the script?
add-user.sh just adds the user to: mgmt-users.properties
so you can generate this value for yourself pretty easily.
This will give you access to the container
docker exec -it wildfly-instance /bin/bash

Logon failure in running a windows service

I am running a service called prunner on windows server 2012. I used the command sc to change the username and the password of the service:
sc.exe config myService obj= "sqa265\hero" password= "hero1"
The output of the command is saying that it have succeed but when I go to task manager in order to start the service I get: logon failure!!!
I tried to run the sc command under the user hero and under the user administrator but I still get the same error. But the very strange thing is that if I do the same thing manually via the task manager and service control pane I success and the service go to the state:running!!! But I need to automate this thing, so please any help?
You need to give the account "sqa265\hero" the SeServiceLogonRight permission. As you have noticed setting the credentials up through the control panel works, but what you might not have noticed is that if you tried to use the command line after using the control panel.
You can test this by setting the service back to the Local System account in the control panel, and then running your command-line again.
To fix this from a script, you can use the NTRights utility outlined in this MS knowledgebase article:
http://support.microsoft.com/kb/315276
After you install NTRights, you can run it like this:
NTRights.exe +r SeServiceLogonRight -u "sqa265\hero"
Combined with the sc config commandline you already have, the service should run with those credentials.
Further reading:
http://www.techrepublic.com/article/set-user-rights-using-the-ntrights-utility/5032903