-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to scaffold, run, debug, test, and deploy a LoopBack 4 application using Appsody CLI #4215
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together!
Besides the comment, I have one more question: would we be showing up how to connect with other databases in a LB4 application as well? I thought you were looking into it.
docs/site/Appsody-LoopBack.md
Outdated
The template application is only a starting point. Let's build a proper, basic | ||
LoopBack 4 application. | ||
|
||
Let's build the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we need this section because it's the same as the todo tutorial.
I can see the advantage of having all the instructions in one place without clicking other docs. However, my concern of having duplicating the content here is if there's any change in the prompts, we need to update it in 2 places. Personally, I'd like to see this tutorial to be more focus on the specific things we need to do when deploying Apposody.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo also talks about the geoservice. We don't need that. Also. The todo doc is out of date in terms of prompts. We can replace this Building your application
section with `follow the Todo tutorial starting with 'Add model' and do not do 'Adding geo-service'.
I was trying to avoid any relational database stuff because I wanted to avoid talking about setting up a database on IBM Cloud.
Raymond's changes to the structure/documentation of the shopping cart application was geared to show how to deploy an app docker container, a mongo container, and a redis container to a kubernetes cluster. So I figured this was sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Appsody, using the nodejs-loopback stack ( a template of a loopback app), it is very simple to run/debug/test/stop and app locally. And very simple to deploy to kubernetes. Before deploying to kubernetes, we would need to change the db url in the datasource json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhmlau , we can start with this, and then provide a follow-up in the future for dealing with a relational database
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. as the first step, I'm fine with just using the in-memory database.
As I was preparing this document, I came across these issues : #4216 . I also came across other issues that @raymondfeng fixed in this PR : appsody/stacks#488 . |
@mhdawson, this might be a good candidate for QuickLab for the upcoming conferences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👏
@joesepi, what do you think in terms of quicklab. Probably too late for NodeJSInteractive since it's only a couple week away (correct me if I'm wrong on this front), but could be a good option for the standard set we use for next year. |
A fix was provided for #4216 by @raymondfeng . Thanks, Raymond :) |
docs/site/Appsody-LoopBack.md
Outdated
@@ -0,0 +1,990 @@ | |||
--- | |||
lang: en | |||
title: 'Deploying to Cloud with Appsody' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title should be Developing and Deploying LoopBack Applications with Appsody
.
docs/site/Appsody-LoopBack.md
Outdated
permalink: /doc/en/lb4/Appsody-LoopBack.html | ||
--- | ||
|
||
## LoopBack 4 & Appsody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header can be ## Introduction
or ## Overview
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choosing Overview.
|
||
[Appsody](https://appsody.dev/docs#welcome-to-appsody) is designed to help | ||
develop containerized applications for the cloud. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention https://kabanero.io/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention https://kabanero.io/?
@raymondfeng , how do we want to mention it? I downloaded and used the appsody CLI with homebrew. I didn't use kabanero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial thought was to make our users aware that Kabanero is a broader offering that uses Appsody for cloud native app dev/dep.
docs/site/Appsody-LoopBack.md
Outdated
|
||
We're going to show you how to scaffold, run, stop, debug, and test a LoopBack 4 | ||
application locally. Then we're going to show you how to build and deploy this | ||
application to the [IBM Cloud](https://www.ibm.com/cloud). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing We're going to show you
twice. Can we use a different phrase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to show you how to scaffold, run, stop, debug, and test a LoopBack 4 application locally. Then, you'll learn how to build and deploy this application to the [IBM Cloud](https://www.ibm.com/cloud).
docs/site/Appsody-LoopBack.md
Outdated
7. Now that all the dependencies have been installed, it is a perfect time to | ||
open your favourite IDE editor on this project. | ||
|
||
In my case, I using VS Code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using
-> use
.
docs/site/Appsody-LoopBack.md
Outdated
npm install | ||
``` | ||
|
||
7. Now that all the dependencies have been installed, it is a perfect time to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a perfect time to
-> it's ready to
or let's
?
docs/site/Appsody-LoopBack.md
Outdated
The template application is only a starting point. Let's build a proper, basic | ||
LoopBack 4 application. | ||
|
||
Let's build the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing let's build
twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"
The template application is only a starting point.
Let's build a proper, basic LoopBack 4 application.
We'll use the todo list
application from the Todo Tutorial as an example.
"
![lb4appsody_template_files_2.png](./imgs/lb4appsody_template_files_2.png) | ||
|
||
10. This basic application only defines one API endpoint `'/ping'` in the file | ||
**src/controllers/ping.controller.ts** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can mention the initial application is very much similar as the one generated by lb4 app
command but it's going to be a loaded by a facade that sets up health/metrics for cloud native observability.
We will run, test, debug, and stop this application **locally** in the next | ||
section. | ||
|
||
## Running/Testing/Debugging/Stopping a LoopBack 4 Application Locally using Appsody |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should mention the watch
capability - as we make changes to the project locally, the application can be redeployed to a docker container as we go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should mention the
watch
capability - as we make changes to the project locally, the application can be redeployed to a docker container as we go.
@raymondfeng , I mention this in the sentence: By default, 'File watching' is **enabled** when you run the command 'appsody run'. This means you can change a file in your project, and then Appsody builds/runs a new Docker container for you automatically.
docs/site/sidebars/lb4_sidebar.yml
Outdated
@@ -187,6 +187,11 @@ children: | |||
url: deploying-with-pm2-and-nginx.html | |||
output: 'web, pdf' | |||
|
|||
- title: 'Deploying to Cloud with Appsody' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating title as well
Let's somehow use or add a new diagram for https://appsody.dev/static/2f908188a17e5e471158534326fc5665/0a44b/appsody_flow.png? |
@emonddr Please fix the formatting - see https://travis-ci.com/strongloop/loopback-next/jobs/262349584 |
docs/site/sidebars/lb4_sidebar.yml
Outdated
@@ -10,799 +10,766 @@ | |||
title: LoopBack 4 | |||
url: index.html | |||
children: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the formatting changes and only leave your addition using the current format.
28ef135
to
957c0d2
Compare
… cli Use the 'nodejs-loopback' stack and the Appsody CLI to scaffold, run, debug, and test a LoopBack 4 application locally, and how to deploy this application to Kubernetes on the IBM Cloud.
957c0d2
to
7c84404
Compare
### Stopping a LoopBack 4 Application Locally using Appsody | ||
|
||
If your application is currently running under Appsody control, you can stop it | ||
with `Ctrl+C`, or by running the command `'appsody stop'` from another terminal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if I have multiple apps started by appsody run
, would this command stop all of them? Is it possible to provide a container name as argument to specify which one to stop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if I have multiple apps started by
appsody run
, would this command stop all of them? Is it possible to provide a container name as argument to specify which one to stop?
Good question. But out of scope for this article. More for Appsody FAQ.
But from what I understand and observe, the .appsody-config.yaml
file in your project directory (e.g. appsodyLB4Todo) has a project-name
value:
project-name: appsodylb4todo
stack: appsody/nodejs-loopback:0.1
When appsody run
is executed (from inside directory appsodylb4todo), it starts a docker container named
appsodylb4todo-dev
To do: appsody stop
, you must also be inside the directory appsodylb4todo .
Then it stops and removes this container.
So, if you have multiple apps started from separate project directories, and they have unique project directory names, you should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to do: appsody stop, you must also be inside the directory appsodylb4todo .
Magic! Now I understand how the run and stop cmd finds the app. thanks for explanation!
How to use the nodejs-loopback stack and the Appsody CLI
to scaffold, run, debug, and test a LoopBack 4 application locally,
and how to deploy this application to the IBM Cloud.
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈