Online App

This section describes how to create an Online Carol App from Carol's template.

To start the process to create a Carol App, you need to run the following command:

bash -c "$(curl -fsSL https://raw.github.com/totvslabs/carolapp/master/install.sh)"

Online Carol App

After selecting to create an Online Carol App, the following question may appear in case this is not your first time running this process:

18781878

You can press enter, sending yes, for this process to download the files again to make sure you are running the most updated templates.

After that, the whole process will ask you the following questions:

full_name [Totvs Labs]: Robson Poffo

email [[email protected]]: [email protected]

github_username [totvslabs]:

project_name [Carol App Boilerplate]: First Online App

project_slug [first_online_app]:

project_short_description [Carol App Boilerplate contains all the boilerplate you need to create a Carol App.]: This is the description related to my project. Used inside the manifest file.

version [0.1.0]:

sonarqube [True]:

carol_app_organization [my_organization]: poffo

carol_app_tenant [my_tenant]: poffo

algorithm_name [alg_first_online_app]: server

algorithm_description_en_US [Algorithm Description]: Process responsible to make available all services for my first online carol app.

algorithm_description_pt_BR [Descrição do Algoritmo]: Processo responsavel em tornar disponivel todos os serviços relacionados ao meu primeiro online carol app.

carol_app_docker_image [carol/first_online_app:0.1.0]:

pycarol_version [latest]:

Select carol_app_machine_types:
1 - c1.nano
2 - c1.micro
3 - c1.small
4 - c1.medium
5 - c1.large
6 - c1.xlarge
7 - c1.2xlarge
8 - g1.v100.large
9 - g1.v100.xlarge
Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9 (1, 2, 3, 4, 5, 6, 7, 8, 9) [1]: 1

First Online App created successfully.

✔  Your new Carol App was successfull created. Check Carol App documentation to learn more.

This is the brief description for each parameter requested:

PropertyDescription
full_nameThe user creating this application. This information is used for internal purposes.
emailThe user creating this application. This information is used for internal purposes.
github_usernameThe user creating this application. This information is used for internal purposes.
project_nameThe project name is used to identify the project and update the Readme.md file.
project_slugSlug project is used to create the folder of your project.
project_short_descriptionIt is used to update the Readme.md file.
versionIt is used for internal reference for this application and to update the Readme.md file.
sonarqubeIn case you enable it, the process will prepare the project to run sonarqube
carol_app_organizationCarol's organization where this project will be deployed.
carol_app_tenantCarol's tenant where this project will be deployed.
algorithm_nameThe algorithm name is the algorithm used in the manifest file.

For reference related to the manifest file, please refer to the chapter "Manifest file" on this documentation for more details.
algorithm_description_en_USThe algorithm description (US) is used to share information with the user on Carol's UI. This information will be updated in the manifest file.

Refer to the section "Manifest file" for more information about this file.
algorithm_description_pt_BRThe algorithm description (PT) is used to share information with the user on Carol's UI. This information will be updated in the manifest file.

Refer to the section "Manifest file" for more information about this file.
carol_app_docker_imageThe docker image provided at this point will update the Dockerfile to build the docker image with the specified name and update the manifest file. When you run this application it will look for the specified docker name specified here.
pycarol_versionPyCarol version refers to the pyCarol version this app has the dependency. The file requirements.txt will be updated with this information.
carol_app_machine_typesThis is the instance type to run this application. To verify all possible instance types, please, verify the documentation.

Once you finished the process, you will see the following success message:

13061306

This message means everything is fine. You can enter the new folder created (slug) and we can start exploring the available "make" options.

The following commands are available when we run the command "make".

$ make
first_online_app Makefile help.

all_tests                      Runs all test related tasks
build_ci                       Build CI Docker Image
clean                          Cleans all temporary and preprocessed files
code_scan                      Execute a Code Qualiry scan and send the data to SonarQube server
coverage                       Create XML and HTML Test coverare report.
dev                            Install all development packages dependencies
dist                           Create the dist file to deploy on Carol
docker_image                   Build first_online_app-server Carol app docker image
docker_run                     Runs first_online_app-server Carol app docker image
docker_run_dev                 Runs first_online_app-server Carol app docker image in Development mode using local code
docs                           Compile all package documentation in HTML format
help                           Show this help message
htmlcov                        Opens the current test coverage report on the default browser
init                           Install all package dependencies
lint                           Lint all code for best practicies
run                            Runs the online app locally on http://localhost:5000
test                           Runs all project test suite, recording all test converage data
venv                           Create the virtualenv for this Carol App

Additional information:

  • The docker image builds provided by make build the image locally. In the section "Building Docker Image on Carol" we will explain how to build the docker image on the platform, making the docker image available for any Carol App we run on top of the platform Carol.

Building the Docker Image

If you want to test your local image into your own docker registry, you can build the image using the make command, tag your image to prepare it for the push and after, you need to push it into your registry. These are the commands to perform it:

First, we build the image (make sure you have docker installed on your machine):

$ make docker_image

This command will return something similar:

.....
Successfully built e0102c0e1526
Successfully tagged first_online_app:latest

Next, we tag the image to prepare it to push to your Docker registry (make sure you are using the right tag):

docker tag first_online_app:0.1.0 robsonpoffo/first_online_app:0.1.0

The last step is to push it to your own Docker Registry. If you do not have, please verify the steps here: https://docs.docker.com/registry/

docker push robsonpoffo/first_online_app:0.1.0

This command will return something similar:

The push refers to repository [docker.io/robsonpoffo/first_online_app-server]
3dee5a222cd4: Pushed
84430b4585a1: Pushed
95e360319baa: Pushed
348c3d784eca: Pushed
e5cf317c6146: Pushed
7d1b621fef71: Pushed
93a8b7ed8c52: Pushed
3f975a33acbf: Pushed
69168fb9b7b0: Pushed
31f78d833a92: Pushed
2ea751c0f96c: Pushed
7a435d49206f: Pushed
9674e3075904: Pushed
831b66a484dc: Pushed
latest: digest: sha256:2b6d8b6cd660d783544d4710a4532a965fcf1d52f92004618d9a11b4ec421d59 size: 3261

Updating the Docker Image on Manifest file

After that, you can update your manifest file and test the Docker Image inside Carol:

{
  "online": {
    "processes": [
      {
        "name": "first_online_app",
        "algorithmName": "server",
        "namespace": "",
        "algorithmTitle": {
          "en-US": "Process responsible to make available all services for my first online carol app.",
          "pt-BR": "Processo responsavel em tornar disponivel todos os serviços relacionados ao meu primeiro online carol app.",
          "pt-br": "Processo responsavel em tornar disponivel todos os serviços relacionados ao meu primeiro online carol app."
        },
        "algorithmDescription": {
          "en-US": "This is the description related to my project. Used inside the manifest file."
        },
        "instanceProperties": {
          "profile": "",
          "properties": {
            "dockerImage": "docker.io/robsonpoffo/first_online_app:0.1.0",
            "instanceType": "c1.nano"
          },
          "tenants": {
            "EXAMPLE_ENV_1": "value_1",
            "EXAMPLE_ENV_2": "value_2"
          }
        }
      }
    ]
  }
}

Additional Information

Deploying the Online Carol App in Carol

After that, in Carol:

  • Upload the manifest file:
18851885
  • Execute the task:
18831883
  • See the new URL available:
18861886