How to get the authenticated users in a heroku dyno? - heroku-cli

Does anyone know how I can get the credentials of the logged user in a heroku dyno?
Context: We are trying to log access to Heroku production rails console. People access it via heroku run or heroku exec. Heroku does authenticate the users executed the command, however, I'm unable to retrieve this information once the rails console is started.
It looks like heroku cli is not available in the dyno, and whoami returns dyno.
Eg:
$ heroku run rails c -a opt-prod
<in rails console>
irb(main):001:0> ENV
irb(main):001:0> `whoami`

We contacted Heroku and there is no option to do this. Instead,
A running dyno doesn't contain
information on the user that started the process, so there's no way to
get the "current user" from inside a dyno on Heroku.
However, one idea for a workaround is to grab the current Heroku CLI
user and sends it along with the console command when starting.
Something like this will work:
CURRENT_HEROKU_USER="$CURRENT_HEROKU_USER" rails c --app my-app-name
> Running CURRENT_HEROKU_USER=chap#heroku.com rails c...
ENV['CURRENT_HEROKU_USER']
> "chap#heroku.com"
The downside of this approach is there's no way to validate that value from inside the dyno. However you could use
your application logs to retroactively verify the info. The API will
log the user who started the console process in your application logs:
CURRENT_HEROKU_USER=chap#heroku.com rails c by user chap#heroku.com
I'm sorry we don't have a better answer for you here.
Please let me know if I can be of more help.

Related

how to get firebase cloud messanging running on local host

I try to get a simple firebase cloud message app, web, to run. The README of the sample app says:
1. On the command line run `firebase serve -p 8081` using the Firebase CLI tool to launch a local server.
That gives the error
Error: Cannot understand what targets to deploy/serve. If you are using PowerShell make sure you place quotes around any comma-separated lists (ex: --only "functions,firestore").
So I tried
firebase serve -p 8081 .
which returns
Having trouble? Try firebase [command] --help
How can I get a local web app that receives messages get running? Will similar troubles start again when hosting on firebase.
I am stuck. Firebase is an endless series of weird docu, weird results, all errors have been encountered by others and there are lon long threads on any of them.

Euca 5.0 No Node Controllers

I've used the ansible install to run all services on a single host and have two separate physical node controllers.
Everything installed fine and all of my services are green. But I don't think image workers are launching to do my first image uploads. As I'm trying to troubleshoot I see that no node controllers are reported by:
euserv-describe-node-controllers
It doesn't return an error just blank output. I've unregistered and re-registered the two node controllers and copied the CLC admin keys with no errors but still can't see output from that command. cloud-output and the various nc log files seem to show successful startup.
I've switched to ImagingServiceAdministrator to look for imaging worker instances with this and got blank output which was what started me looking at NC's:
euca-describe-instances --filter tag-value=euca-internal-imaging-workers
The imaging service is not required for installing instance-store images, e.g.:
python <(curl -Ls https://eucalyptus.cloud/images)
or (on an ansible deployed cloud):
eucalyptus-images --size 1
To check on the status of node controllers in a deployment you will need to have cloud administrator credentials. You can check this using:
euare-getcallerid
euare-accountlist
and verifying that the eucalyptus account is being used.
Node controllers are managed via a cluster controller so you should check the status for both:
euserv-describe-services -a --filter service-type=cluster
euserv-describe-services -a --filter service-type=node
this differs from euserv-describe-node-controllers as it does not include information on running instances.
If there are any issues you can check for service events:
euserv-describe-events
and look at the logs (/var/log/eucalyptus/...) to further investigate.
Check that the IP addresses you registered node controllers using are the ones that the node controllers are listening on (NC_ADDR in /etc/eucalyptus//eucalyptus.conf)
If using firewalld restart/reload the configuration after deployment to ensure running with the latest settings.

Windows Server 2016 mount shared folder as disc permanently also on restart

I'm have local access to a shared folder with credentials.
net use Z: \\server\folder /u:user /persistent:yes passwd
The files in this folder are to be used by other processes.
The problem is that when the machine is restarted, the connection is lost, meaning that I can see that the Network Device Z is there, but it does not automatically connect to it, so that the processes have no longer access to the folder.
I have tried several solutions with no avail:
Creating a Windows scheduled task to run a script with 'net use Z:...',
a. with my_user I get this error in Event Viewer: "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID"
b. with System, I get no errors but the connection is not created.
I've tried to log stdout and stderr to debug the script, but it does not even
create the log file. (The used script is shown below)
#echo off
'> map.log 2>&1(
net use Z: \server\folder /u:user /persistent:yes passwd
)
Crating a Symlink was another solution I had found, but it is not suitable for my case,
because it does not allow credentials. It seems that the resource has to be either
unprotected or already available locally.
Creating a Startup Script from Local Group Policy Editor, I get the same error in
Event Viewer
Running 'net use Z:...' via a Python script installed ad Windows Service,
import subprocess
proc=subprocess.Popen(r'net use Z: \server\folder /u:user pass', shell=True)
out, err = proc.communicate()
print("out:%s, err:%s"%(out,err))
If I run the python script manually, it works, while running it as a service creates a
disconnected drive.
Can anyone give me an advice on how to proceed?
Thanks

How to run my informatica workflows using the pmcmd/.ksh?

I am trying to run the workflows using pmcmd or .ksh, but i m facing the error
saying
Failed to authenticate login. [UM_10205] [UM_10205] Failed to authenticate the user [user_name] that belongs to the security domain [e-directory]. For more information, see the domain logs.
Disconnecting from Integration Service.
I have tried logging into informatica and run the workflows thru workflow manager, it is running. I am not able to find the reason why it is saying authentication issue, if it is an authentication issue it should not allow me to login to informatica.
pmcmd startworkflow -sv intg_ser -d Domain_name -usd e-directory -u user -pv encrypted_passwd -f app_CCMLB_FPERX -wait wf_4100_CCML_CAP_PKG_EXT

Terminate and restart Google DataLab instance?

I am finding when working with larger datasets that the kernel may die, something I also experiance on my local machine. Sometimes it comes back and sometimes not. So even the Tree panel won't react to terminate a errant Kernel. EG "restart" does not work and the server itself seems to die. So the tree view won't respond or refresh. On my local machine I just kill the terminal instance and start over.
What is the "proper" way to restart everything?
FWIW the instance seems pegged at 150% cpu utilization atm
Related: is there any way to allow long running stuff to work?
I am trying to use a report generator (pandas-profiling) on a 2mm record dataset.. Works on my local..
found it here: https://cloud.google.com/datalab/getting-started
FWIW These commands can be used in the new command line shell on the Cloud console page.see https://cloud.google.com/shell/docs/ .. Without the sdk on your machine.. You need to modify the commands slightly since you will be logged into your project already,
Stopping/starting VM instances
You may want to stop a Cloud Datalab managed VM instance to avoid incurring ongoing charges. To stop a Cloud Datalab managed machine instance, go to a command prompt, and run:
$ gcloud auth login
$ gcloud config set project <YOUR PROJECT ID>
$ gcloud preview app versions stop main
After confirming that you want to continue, wait for the command to complete, and make sure that the output indicates that the version has stopped. If you used a non-default instance name when deploying, please use that name instead of "main" in the stop command, above (and in the start command, below).
For restarting a stopped instance, run:
$ gcloud auth login
$ gcloud config set project <YOUR PROJECT ID>
$ gcloud preview app versions start main

Resources