Deploying Node.js using Azure CLI and Git - node.js

I am trying to get my head around Node.js and using it for building bots. There's a long convoluted reason why I need to do this, the TLDR version is I need it for university.
Anyway, I have found a book online, it's called "Building Bots with Node.js" by Packt publishing. I am working through the book, and I have got to a section where I am supposed to Deploy my app to azure. The book says to do the following, in order:
Create a site with azure site create --git (sitename)
Run git add .
Run git commit -m "TwilioNodeBot first commit
Run git push azure master
Now, steps 1-3 worked fine. But when I get to step 4, I get a Windows pop-up asking me to enter credentials for my site. I have tried everything I can think of, but no matter what I enter I get the following error:
fatal: Authentication failed for 'https://username#sitename.scm.azurewebsites.net/sitename.git/'
Now, the thing is, it says the following in the book:
"After you type these commands, if you've never set up git/FTP deployment credentials for your Azure subscription, you'll also be prompted to create them. You can also enter these credentials on the Azure Portal."
I was never asked to create credentials. I did a bit of web searching and found out how to go into my portal and view my publishing profile, and get the username/password out of there. But when I do enter this information it doesn't work. I even tried resetting my credentials, but this didn't work either.
There's no information in the book about what to do here, and I cannot contact the author as there is no contact info.
Any ideas? What am I supposed to use for my publishing credentials?

OK, I figured it out. I had to open my "config" file in the ".git" folder and update the username at the start of the url.

Related

Log in to Github via Fedora Server 37

I am using Mac OS as my main operating system. I installed fedora 37 server edition in a VMware workstation as part of my course in college. I am trying to customize my prompt using this repo https://github.com/andresgongora/synth-shell.
I have installed git already. I also have power line-fonts installed. The issue I am having comes with this command: git clone --recursive https://github.com/andresgongora/synth-shell.git
When typed and executed I get a prompt asking me for a GitHub username and password. I enter my credentials and I get an error stating "Authentication Failed for https://github.com/andresgongora/synth-shell.git" even though my credentials are correct.
I have tried putting my username and password (both combinations separately) and I get an event error. I configured a global username and that doesn't work either.
Am I supposed to log in to my GitHub before cloning this repo? Does anyone else experience this or have a workaround?
I have tried putting my username and password (both combinations separately) and I get an event error. I configured a global git username and that doesn't work either.
Sites used:
Can't clone a github repo on Linux via HTTPS
https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git
https://documentation.red-gate.com/soco/troubleshooting/authentication-failed-when-cloning-from-github
Edit: I have also tried setting up a token to log in with. The only issue I am having is my linux distro does not support copy and paste so I am having to type everything out. When the password prompt comes up everything is blank to hide your password so I can't even check for spelling errors.
As of mid 2021, github the company is now enforcing git HTTPS authentication to use an access token rather than username+password. See this stackoverflow answer for full information.
One way forward is to generate an SSH key, and upload the public portion to github.
It warrants mentioning that this change is specific to Github Inc., the Microsoft subsidiary. There have not been any changes to git, the distributed version control system. Other, similar repository hosting services may not necessarily bar you from authenticating via username+password. Gitlab is one example.
I managed to fix my issue by using cockpit in my web browser. Doing this allowed my to copy and paste my information and everything worked first try.
Beginner problem.

Gitkraken bitbucket token invalid

I am using gitkraken on linux and it is excellent application. When I authenticate with bibucket, app will connect.
But when I try to make push, app will display error in top panel:
Your oAuth token for 'Bitbucket' is invalid. Would you like to refresh
your oAuth credentials or try again without oAuth?
When I will select "Refresh Token" option I have to reconnect to bitbucket with the same result
"Retry without oAuth" option not connect (without error message), althought on bitbucket.org same login/pass work.
Originly I used another bitbucket account and that works, but with new one I cannot manage it.
Do someone has similar experience? Did you solve it?
I managed to solve it by deleting the remote and adding it again.
I tried a couple of things and it worked for me:
close git graken
opened powershell / cmd and navigate to the repo
git pull
open git kraken
go into the preferences (the little burger on the top right)
integrations, re-enter the token from gitlab or whichever tool you might be using
Alternately, I also tried closing the repo in git kraken and opening it from the main page also. it works for me now.
I had the same problem and I deleted and recloned my repo and it worked.
I used "GitHub Desktop". It showed the conflicts and once i fix them, i run GitKraken and the top panel asking for "oauth" disappeared.

How could I prohibit anonymous access to my NodeRed UI Dashboard on IBM Cloud(Bluemix)?

I'm working with node-red, on boilerplate IBM cloud. I know that there is a way, changing the value of enviroments variables(NODE_RED_USERNAME and NODE_RED_PASSWORD), to change username and password of the editor flow. But, what about UI dashboard? I mean using dashboard nodes. Forbid access to
https://noderedservicename.mybluemix.net/ui/
I know that on the code, changing the variable httpNodeAuth on the file settings.js I can do what I want. What is the way for doing that on IBM Cloud?
Thank you in advance!
You need to add the httpNodeAuth (not the httpAdminAuth as this is for controlling access to the Node-RED editor and can done with the environment variables discussed in the other answer.) to the app/bluemix-settings.js file.
Something like this:
...
httpStatic: path.join(__dirname,"public"),
httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
functionGlobalContext: { },
...
Details of how to generate the pass can be found here
There are a number of ways you can edit the file, some of which include linking the Node-RED deployment to a git repository or downloading the whole app, editing the file and pushing it back to Bluemix (when you first deploy Node-RED from the starter pack it gives you instructions on how to download the source to make changes and then push them back. You can get to these instructions by clicking on the "Getting started" link in your Node-RED Bluemix console page).
But the quickest/simplest/dirtiest way is probably to just SSH into the instance and change the file with something like vi. Details on how to ssh to an app instance can be found here. But the following should work:
cf ssh [app name]
Once you have edited the file you will need to tell bluemix to restart the app. You can do this from the web console or with the cf command line tool.
(The changes made by this method will not survive if the app is restaged, or bluemix decides to move your instance to another machine internally because it will rebuild the app from the pushed sources. The permanent solution is to download the source, edit and push back)
This link will help you but it's written in Japanese.
http://dotnsf.blog.jp/archives/1030376575.html
Summary
You can define the "user-defined" environment variables through the IBM Cloud dashboard.
It contains the variables to protect Node-RED GUI.
You have to be set as follows
NODE_RED_USERNAME : username
NODE_RED_PASSWORD : password

Migrating from Openshift v2 to v3 (Node/MongoDB) - cannot create new-app

I have an active/working Node/Mongo app on Openshift Origin (v2) but I apparently have to migrate to the v3 system soon so, whilst I've attempted to follow the (frankly way too basic) migration guide, I'm hitting an error which is meaningless to me.
I've edited my project as per the migration guide, moved it to GitHub, setup v3, run "oc login" and I'm trying to create a new-app from the GitHub code with
oc new-app https://github.com/shrewdlogarithm/steamtrayapi.git --name=steamtrayapi
It runs for a while and then spits out the following errors
error: User "censored#gmail.com" cannot create imagestreams.image.openshift.io in project "default"
error: User "censored#gmail.com" cannot create buildconfigs.build.openshift.io in project "default"
error: User "censored#gmail.com" cannot create deploymentconfigs.apps.openshift.io in project "default"
error: User "censored#gmail.com" cannot create services in project "default"
I have no idea where to go from there.
Note: see comment - seems to be an authentication issue and/or just a badly documented process.
If anybody was following these migration directions, the issue is that in openshift 3 applications need to be placed under projects. Those instructions don't bother to mention that, but what you want to do is create a new project if you don't have one already
oc new-project <project-name>
Now run the oc new-app command you previously tried, and it should work.

Docker on Azure .Net Core WebApi with continuous deployment - did it work?

I followed the following: https://www.visualstudio.com/en-us/docs/build/apps/aspnet/aspnetcore-to-azure and everything appears to work just fine. My build work and my Dev release was successful.
At the end of the documentation it says:
When the release has completed, browse to your web site, refresh the
page, and see that the change has been deployed.
But I have no idea what that url is? How do I tell where that is or if everything did in fact work? Sorry for the dumb question, I have never worked with any of this before - thank you.
That's the URL you choose for your web app before.
See step 5 in the previous step "Define and test your CD release process":
After the release is complete, navigate to your site running in Azure using the Web App URL http://{web_app_name}.azurewebsites.net, and verify its contents.
You can try following this guide: https://blogs.msdn.microsoft.com/webdev/2016/11/16/new-docker-tools-for-visual-studio/
By doing it with Visual Studio, it creates by itself the complete pipeline which you can then modify or extend.
In the case you would like to have more than one service I recommend following this guide: https://learn.microsoft.com/en-us/azure/container-service/container-service-setup-ci-cd
Both guides helped me to understand how ACS works, also will be worth watching the Docker section in the Visual Studio Lunch Keynote :)

Resources