CodeSandbox: Using terminal in node template - codesandbox

I'm trying to create a sandbox using the node template but I'm running into issues accessing the terminal. I have a sandbox here that I've uploaded using their define API which should be using a node template (defined in my sandbox.config.json) and have a defined start script. It shows a 504 and doesn't give me access to the terminal. What am I doing wrong?

After more research: I now see the sandbox running in a node environment, but no terminal - but hovering over the "+" on the upper right of the info/console window gives a tooltip "Fork to add a Terminal". I did so, and the terminal became available. I conclude it's some form of ownership issue - I can't open a terminal in your sandbox, but I can in my forked sandbox.
We can conclude that the define API creates a public template/sandbox - but the terminal is only available in a private sandbox. To use the terminal, you'll have to fork the sandbox after creating it.
(thx to #codesandbox for including the tooltip that led to the conclusion)

That's not a container environment, which is required to have access to a terminal. There are known issues with containers & codesandbox; specifically, you can't convert one sandbox type to another, and sometimes forking from someone else's github also does not create as a container.
Best to start with a containerized template.

In case this helps anyone: to enable containers for an existing project you need to create a sandbox.config.json file with the following content before creating the sandbox:
{
"template": "node"
}
I'm not sure if there is a way to change the sandbox once it's created.
Ref: https://github.com/codesandbox/codesandbox-client/issues/1608

Related

Error in Google Cloud Shell Commands while working on the lab (Securing Google Cloud with CFT Scorecard)

I am working in a GCP lab (Securing Google Cloud with CFT Scorecard). All instructions for the lab are given.
First I have to run the following two commands to set environment variables
export GOOGLE_PROJECT=$DEVSHELL_PROJECT_ID
export CAI_BUCKET_NAME=cai-$GOOGLE_PROJECT
In the second command given above I don't know what to replace with my own credentials? May be that is the reason I am getting error.
Now I have to enable the "cloudasset.googleapis.com" gcloud service. For this they gave the following command.
gcloud services enable cloudasset.googleapis.com \
--project $GOOGLE_PROJECT
Error for this is given in the screeshot attached herewith:
Error in the serviec enabling command
Next step is to clone the policy: The given command for that is:
git clone https://github.com/forseti-security/policy-library.git
After that they said: "You realize Policy Library enforces policies that are located in the policy-library/policies/constraints folder, in which case you can copy a sample policy from the samples directory into the constraints directory".
and gave this command:
cp policy-library/samples/storage_blacklist_public.yaml policy-library/policies/constraints/
On running this command I received this:
error on running the directory command
Finally they said "Create the bucket that will hold the data that Cloud Asset Inventory (CAI) will export" and gave the following command:
gsutil mb -l us-central1 -p $GOOGLE_PROJECT gs://$CAI_BUCKET_NAME
I am confused in where to replace my own credentials like in the place of project_Id I wrote my own project id.
Also I don't know these errors are ocurring. Kindly help me.
I'm unable to access the tutorial.
What happens if you run the following:
echo ${DEVSHELL_PROJECT_ID}
I suspect you'll get an empty result because I think this environment variable isn't actually set.
I think it should be:
echo ${DEVSHELL_GCLOUD_CONFIG}
Does that return a result?
If so, perhaps try using that variable instead:
export GOOGLE_PROJECT=${DEVSHELL_GCLOUD_CONFIG}
export CAI_BUCKET_NAME=cai-${GOOGLE_PROJECT}
It's not entirely clear to me why this tutorial is using this approach but, if the above works, it may get you further along.
We're you asked to create a Google Cloud Platform project?
As per the shared error, this seems to be because your env variable GOOGLE_PROJECT is not set. You can verify it by using echo $GOOGLE_PROJECT and seeing whether it returns the project ID or not. You could also use echo $DEVSHELL_PROJECT_ID. If that returns the project ID and the former doesn't, it means that you didn't export the variable as stated at the beginning.
If the problem is that GOOGLE_PROJECT doesn't have any value, there are different approaches on how to solve it.
Set the env variable as you explained at the beginning. Obviously this will only work if the variable DEVSHELL_PROJECT_ID is also set.
export GOOGLE_PROJECT=$DEVSHELL_PROJECT_ID
Manually set the project ID into that variable. This is far from ideal because in Qwiklabs they create a new temporal project on every lab, so this would've only worked if you were still on that project. The project ID can be seen on both of your shared screenshots.
export GOOGLE_PROJECT=qwiklabs-gcp-03-c6e1787dc09e
Avoid using the argument --project. According to the documentation, the aforementioned argument is optional and if none is used the command will take the one by default, which will be on the configuration settings. You can get the current project by using this:
gcloud config get-value project
If the previous command matches the project ID you want to use, you can simply issue the following command:
gcloud services enable cloudasset.googleapis.com
Notice that the project ID is not being explicitly mentioned using --project.
Regarding your issue with the GitHub file, I have checked the repository and the file storage_blacklist_public.yaml doesn't seem to be in the directory policy-library/samples. There seems to be a trace that it was once there, but it isn't anymore, they should probably update the lab as it isn't anymore.
About your credentials confusion, you don't have to use your own project ID, just the one given on your lab. If I recall properly all the needed data should be on the left side of the lab. Still, you shouldn't need to authenticate in a normal situation as you are already logged in your temporal project if you are accessing it form the Cloud Shell, which is where you should be doing all this.
Adding this for the later versions
in the gcloud shell you can set a temp variable for the current project id with
PROJECT_ID="$(gcloud config get-value project)"
then use like
--project ${PROJECT_ID}

Inside Bluemix cloud, is there anyway to change the WORKSPACE_ID fast?

After I made this demo app to work inside my account on Bluemix cloud
https://github.com/eGlobeBizCom/food-coach,
I create another workspace inside the above Watson Service Instance, and want to connect the above js code app with the second WORKSPACE_ID. Inside Bluemix cloud, in Runtime section, is there anyway to change the above ?WORKSPACE_ID fast? Or we have to change the WORKSPACE_ID manually in manifest.yml mentioned below
Update conversation service workspace without changing workspace ID
After many searches on the web, no info can answer the above Q. Any suggestions are warmly welcome.
in this case, you can:
1. Edit the workspace ID inside the app.js file in line #61. If this link is really the reposity you are using.
But, dont miss replace the username and password from your Conversation Service, replace with Service Credentials.
Make sure if the workspace have this format if your replace <workspace_id> inside the workspace variable:
var workspace = "4235254-546563g-sfgsg-sgs-ggsfsegs" //test
var workspace = '4235254-546563g-sfgsg-sgs-ggsfsegs' //test
2. You can see the line have the code: process.env.WORKSPACE_ID. This is because the repository use dotenv package, you can simple edit the .env file and replace the value of the WORKSPACE_ID;
3. You can simple add the Enviroment Variables in the IBM Bluemix too! Try:
In this case, you will click in the Runtime, and you will see the "Enviroment Variables". Replace the name with WORKSPACE_ID and the value with your workspace_id. After, restart your application.

"Project is not fully initialized with the default service accounts." Error in brand new account on first project?

i just signed up for Google Could Engine and started the most basic container engine quickstart on a brand new project:
https://cloud.google.com/container-engine/docs/quickstart
a few steps in it has me run this command
gcloud container clusters create example-cluster
which errors out:
$ gcloud container clusters create example-cluster
ERROR: (gcloud.container.clusters.create) ResponseError: code=503, message=Project hello-world-161713 is not fully initialized with the default service accounts. Please try again later.
so far, "trying again later" has not helped: it's been doing this every time for the past few hours.
as usual, Google has no obvious way of getting help in any timely manner, and Googling the error turns up nothing useful.
kind of a long shot but i found a link sending me over here on one of their pages (great support guys) so figured i'd give it a shot. thanks in advance.
The Container Engine API needs to be enabled, and unfortunately that error message is not correct (trying again later won't help).
If you visit the Google Container Engine page in the wb console https://console.cloud.google.com/kubernetes/list it should enable Google Container Engine. Make sure you select the project you're using with the quickstart. You can create your cluster from that page too if you'd prefer.
You can also enable the Container Engine API manually here: https://console.cloud.google.com/apis/api/container.googleapis.com/overview

How can i set a docker action with OpenWhisk in Bluemix?

I was testing OpenWhisk on Bluemix. What i want to do is very very simple. I have a js script that works (it's just a console.log). I have a Dockerfile making a docker .. when i run my docker i can see my console.log \o/ (i know it's amazing)
Then i create my action ......
I try to run it from Bluemix UI
I get this :
failed to invoke action XXX/XXXX: Container hash or name expected in makeContainer.
Just what does it means ? I couldn't find anything on it.
ps : If you know where i can find some real doc about how to use docker container for actions i would be very happy :).
Thanks a lot for your help.
Edit : In the end the problem was that i was trying to pull from a private docker repo. I have to say the error message is not explicit x). Thanks for your help.
You can find the documentation about creating docker actions here: https://new-console.ng.bluemix.net/docs/openwhisk/openwhisk_actions.html#openwhisk_actions_docker
Instructions helps you download the docker sdk for OpenWhisk, and allow you to create a docker action that you can invoke from CLI or Web UI.
If you create the action using the Web UI you need to specify the docker Image from Docker hub using the format username/imagename like openwhisk/example
If you need more help feel free to reach the team on Slack for more real time interactions and we should be able to help you and get your feedback on how can we improve the user experience.
Team: https://developer.ibm.com/open/slack-request
Channel: #openwhisk https://dwopen.slack.com/messages/openwhisk

Railo cannot add event gateway under service in web admin

I am working on a railo 4.2.1.008 server. I can run the web admin from localhost/railo-context/admin/web.cfm and www.mydomain.com/railo-context/admin/web.cfm. Both of them are showing individual settings. But the local one allows me to add an event gateway. When I added one, it lists the added instance above the add form. But in the other one, the form get submits and it is not listing anything. i am not sure it is added or not. Also I am not sure both the admin console are running from a same folder. Can anyone advice me on this?
I also had the same issue.Please check your application.cfc and check for any onrequest codes.In my case I renamed my application.cfc and it worked as the application.cfc variables got reset.