Successful provisioning but no type added


#1

I’m trying to provision on a new local c3server based on the v7.6.1-stable docker image.
The http://localhost:8080/static/console shows correctly.

I have a tiny app folder I would like to deploy myapp with the following command:

c3-prov tag --tenant myapp --tag dev --url http://localhost:8080/ -u BA -p BA -r

I get the following output:

[myapp/dev] No such dependency 'standardDependencies' in package.json can be found in package 'myapp'
[myapp/dev] No such dependency 'machineLearning' in package.json can be found in package 'myapp'
[myapp/dev] Created 1.13Kb ZIP of one package in 0.0s
[myapp/dev] Provisioning completed successfully (2018-07-05T18:01:41.815+02:00)
Time taken: 0m 1.672s
Finished

But when I reload the static/console and switch to the myapp/dev tag I don’t see my types but only the base types apparently:

Switched to tag myapp / dev
main.js:2774 Imported 1906 types (all) from myapp / dev in 742ms
Bar
VM41383:1 Uncaught ReferenceError: Bar is not defined
    at <anonymous>:1:1
(anonymous) @ VM41383:1

One of the types I would like to provision is Bar.c3typ:

type Bar mixes Persistable<Bar>

The other is Foo.c3typ

entity type Foo schema name 'FOO' {
    bar: datetime
}

Both files are located in the src folder inside the myapp folder.
The package.json is:

{
    "name": "myapp",
    "description": "sample app",
    "author": "C3 IoT",
    "dependencies": ["standardDependencies", "machineLearning"]
}

And the repository.json file of the parent directory is:

{
  "name": "training",
  "version": "1.1.0",
  "description": "Training Class",
  "dependencies": {"base" : "7.6.1+379"}
}

I don’t understand why I don’t see my declared types and I don’t understand why the platform does not give more hints on what is wrong when provisioning.


#2

either you provision from folder which contains your repository folder “training” or have option -a point to the folder which contains . “training folder”

/user/pavan/repos/trainingRepo/training/repository.json, your -a ( appspath) should be /user/pavan/repos/trainingRepo or provision from folder /user/pavan/repos/trainingRepo.


#3

I’m provisioning from ~/training folder which contains the repository.json file. The provisionner seems to find the package and puts the c3typ files in the zip (checked the zip command).
If I provision from the parent folder I don’t get any result (empty zip).
Here is the verbose output of the successful command:

➜  training git:(master) ✗ c3-prov tag --tenant myapp --tag dev --url http://localhost:8080/ -u BA -p BA --verbose
Using username BA for authentication
Authentication token: Basic QkE6QkE=
(node:10651) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
tagConfig:myapp
tenantConfig - tags:[object Object]
Error: Error determining git commit of the repository
Results:
[
  null,
  null,
  null
]
[myapp/dev] start zipping.2018-07-05T21:50:10.833+02:00
[myapp/dev] found repos: ["training"]
[myapp/dev] looking for /Users/nabilkoroghli/training//*/package.json in /Users/nabilkoroghli/training
[myapp/dev]  found  packages = 2
[myapp/dev] found packages in repos = 2 names=["lightbulb","myapp"]
[myapp/dev] No such dependency 'standardDependencies' in package.json can be found in package 'myapp'
[myapp/dev] No such dependency 'machineLearning' in package.json can be found in package 'myapp'
[myapp/dev] found packages relevant for tenant  myapp 1 names = ["myapp"], rootPackage = myapp
[myapp/dev] cmd: rm -f /tmp/c3-prov/myapp/dev/prov-myapp-dev-1530820210789.zip; cd /Users/nabilkoroghli/training/; zip -r /tmp/c3-prov/myapp/dev/prov-myapp-dev-1530820210789.zip repository.json training/repository.json myapp/package.json myapp/src myapp/seed myapp/ui myapp/test myapp/resource > /dev/null; cd /Users/nabilkoroghli/training
[myapp/dev] Created 1.32Kb ZIP of one package in 0.0s
[myapp/dev] spec:{"command":"tag","tenant":"myapp","tag":"dev","testData":false,"filter":null,"groups":null,"verbose":true}
[c3/c3] URL: http://localhost:8080/api/1/Provisioner?action=exec
[myapp/dev] Server log:
Tenant myapp exists.
Tag dev exists.
User BA found in tenant myapp
Deploy option tagAction: provision
Deploy option package: myapp
Deploy option packageVersion: null
Deploy option infos: {branch=NA, refSpec=NA, machine=Nabil-Koroghli.local, tools=c3-prov@7.2.0}
Deploy option testData: false
Deploy option filter: null
Deploy option doNotWaitForRunningActions: false
Provisioning types.
Provisioning data.
Deployment successful in myapp/dev
[myapp/dev] Provisioning completed successfully (2018-07-05T21:50:11.740+02:00)
Time taken: 0m 1.26s
Finished

#4

provisioning from folder training, will give incorrect metadata path for file ( without repository name), so types ate not deployed. ( this was fixed in 7.7+).
in 7.6.1, you have to provisionig from parent folder that contains reposiotory folder.

try with verbose and see logs


#5

Here are the logs of provisioning from the parent folder:

➜  ~ c3-prov tag --tenant myapp --tag dev --url http://localhost:8080/ -u BA -p BA --verbose
Using username BA for authentication
Authentication token: Basic QkE6QkE=
(node:11062) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
tagConfig:myapp
tenantConfig - tags:[object Object]
Error determining git status of the repository
[myapp/dev] start zipping.2018-07-05T22:05:38.705+02:00
[myapp/dev] found repos: ["training"]
[myapp/dev] looking for /Users/nabilkoroghli//training/*/package.json in /Users/nabilkoroghli
[myapp/dev]  found  packages = 2
[myapp/dev] found packages in repos = 2 names=["lightbulb","myapp"]
[myapp/dev] No such dependency 'standardDependencies' in package.json can be found in package 'myapp'
[myapp/dev] No such dependency 'machineLearning' in package.json can be found in package 'myapp'
[myapp/dev] found packages relevant for tenant  myapp 1 names = ["training/myapp"], rootPackage = myapp
[myapp/dev] cmd: rm -f /tmp/c3-prov/myapp/dev/prov-myapp-dev-1530821138677.zip; cd /Users/nabilkoroghli/; zip -r /tmp/c3-prov/myapp/dev/prov-myapp-dev-1530821138677.zip repository.json training/repository.json training/myapp/package.json training/myapp/src training/myapp/seed training/myapp/ui training/myapp/test training/myapp/resource > /dev/null; cd /Users/nabilkoroghli
[myapp/dev] Created 1.43Kb ZIP of one package in 0.0s
[myapp/dev] spec:{"command":"tag","tenant":"myapp","tag":"dev","testData":false,"filter":null,"groups":null,"verbose":true}
[c3/c3] URL: http://localhost:8080/api/1/Provisioner?action=exec
[myapp/dev] Server log:
Tenant myapp exists.
Tag dev exists.
User BA found in tenant myapp
Deploy option tagAction: provision
Deploy option package: myapp
Deploy option packageVersion: null
Deploy option infos: {branch=NA, refSpec=NA, machine=Nabil-Koroghli.local, tools=c3-prov@7.2.0}
Deploy option testData: false
Deploy option filter: null
Deploy option doNotWaitForRunningActions: false
Error: [myapp/dev] Server Errors: (2018-07-05T22:05:39.071+02:00)
[Message] could not find localization annotation on c3.love.file.VirtualFileSystemMethods.listDirsStream
[Message] could not find localization annotation on c3.love.file.VirtualFileSystemMethods.listDirsStream
Results:
[
  [
    [
      null,
      null
    ]
  ]
]
Time taken: 0m 0.734s

I’m still not able to get the types provisioned, moreover I get 2 additional errors on localization


#6

that looks like problem reading the zip file ( either traiing repo or base)… see the logs it created /tmp/c3-prov/myapp/dev/prov-myapp-dev-1530821138677.zip with 2 packages. you defined base reposiotry dependency, how is that provided. thoruhg PacakgeManage or local base repo?


#7

I’m new, not really familiar with PackageManager or local base repo.
I tried the following command and it seems that the PackageManager is not configured:

PackageManager.bestRepositoryBuild("base", "7.6.1+39")
all.js?env=browser&compat:19712 POST http://localhost:8080/api/1/myapp/dev/PackageManager?action=bestRepositoryBuild 500 (Server Error)
C3.client.sendRequest @ all.js?env=browser&compat:19712
request @ all.js?env=browser&compat:860
call @ all.js?env=browser&compat:566
c3Call @ all.js?env=browser&compat:99
_call @ all.js?env=browser&compat:2563
(anonymous) @ VM55988:5
(anonymous) @ VM55987:1
all.js?env=browser&compat:569 Uncaught C3.client.ActionError {name: "ActionError", message: "No pm configured in the Vault (TenantConfig)", error: C3.t…s.Obj, stack: "Error: No pm configured in the Vault (TenantConfig…61:20), <anonymous>:5:15)↵    at <anonymous>:1:16"}
call @ all.js?env=browser&compat:569
c3Call @ all.js?env=browser&compat:99
_call @ all.js?env=browser&compat:2563
(anonymous) @ VM55988:5
(anonymous) @ VM55987:1

For the local base repo I checked out on my host machine a c3base repo with the release/v7.6.1 branch and deployed the reference package. I’m not sure if it is sufficient. Is there any documentation all that staff (repository.json, package.json, package manager, base repo…)?

Also, I tried to remove the “base” dependency from repository.json and have got more logs about the types contained in myapp:

Deployment successful in myapp/dev
Error: [myapp/dev] Server Errors: (2018-07-05T22:23:19.109+02:00)
{fileUrl:"/training/myapp/package.json",lineNum:0,colNum:0,severity:"ERROR",message:"Missing dependency package 'standardDependencies' defined in package 'myapp' dependencies"}
{fileUrl:"/training/myapp/package.json",lineNum:0,colNum:0,severity:"ERROR",message:"Missing dependency package 'machineLearning' defined in package 'myapp' dependencies"}
{fileUrl:"/training/myapp/package.json",lineNum:0,colNum:0,severity:"ERROR",message:"Missing dependency package 'standardDependencies' defined in package 'myapp' dependencies"}
{fileUrl:"/training/myapp/package.json",lineNum:0,colNum:0,severity:"ERROR",message:"Missing dependency package 'machineLearning' defined in package 'myapp' dependencies"}
{fileUrl:"meta://training/myapp/src/Bar.c3typ",lineNum:1,colNum:1,severity:"ERROR",message:"Type Bar does not specify a valid schema name.",targetType:"Bar"}
{fileUrl:"meta://training/myapp/src/Bar.c3typ",lineNum:1,colNum:1,severity:"ERROR",message:"Unable to upsert collection for type Bar: Type Bar does not specify a schema name",targetType:"Bar"}
Results:
[
  [
    [
      null,
      null
    ]
  ]
]
Time taken: 0m 6.968s

I fixed the Bar syntax and provisioned again but I still don’t see my types.


#8

you need to have directory where both repos are accessible and provision from there…

examples in directory myrepos/ make a symlink to base and training repos as

cd myrepos/
ln -s …/c3base/base base
ln -s …/trainingRepo/training training

then provision from myrepos folder…


#9

Thank you @pavan.nandikonda this time it is working correctly.