Skip to content
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

feat: Add a root Cargo.toml with workspaces, do some refactoring [fixes DXJ-295] #165

Merged
merged 6 commits into from
Feb 21, 2023

Conversation

shamsartem
Copy link
Collaborator

No description provided.

@linear
Copy link

linear bot commented Feb 20, 2023

DXJ-295 Fluence CLI should utilize cargo workspace so that vscode rust-analyzer works from the project root

By adding a workspace Cargo.toml to the project root, rust tools in vscode are afforded sight into rust subdirs, which is a huge improvement in the DX

as part of adding/creating nee services, the cli should create a Cargo.toml file in the project root dir like so:

[workspace]
members = ["path-to-moduels/*"]

where path-to-modules could be something like services/modules/* depending on the selections made by the user.

A side result is that a signle target dir is create in the root dir with all wasm32-wasi modules in the same place which seems to work for cli and appears a lo faster than the "regular" fluence build.

mbp16~/localdev/local-storage(:|✔) % cat Cargo.toml
[workspace]
members = ["services/modules/*"]

mbp16~/localdev/local-storage(:|✔) % fluence build
Making sure all services are downloaded... done
    Blocking waiting for file lock on package cache
   <...>
   Compiling marine-rs-sdk v0.7.1
   Compiling facade v0.1.0 (/Users/bebo/localdev/local-storage/services/modules/facade)
    Finished release [optimized] target(s) in 19.90s
   Compiling local_storage v0.1.0 (/Users/bebo/localdev/local-storage/services/modules/local_storage)
    Finished release [optimized] target(s) in 20.14s
Making sure all modules are downloaded and built... done
mbp16~/localdev/local-storage(:|✔) % ll
total 120
<...>
-rw-r--r--  1 bebo  staff    47K Feb 16 14:47 Cargo.lock
drwxr-xr-x 6 bebo  staff   192B Feb 16 14:47 target
mbp16~/localdev/local-storage(:|✔) % fluence deploy
Making sure all services are downloaded... done
    Blocking waiting for file lock on package cache
    <...>
    Blocking waiting for file lock on build directory
    Finished release [optimized] target(s) in 0.19s
    Finished release [optimized] target(s) in 0.20s
Making sure all modules are downloaded and built... done

Going to deploy services described in ~/localdev/local-storage/fluence.yaml:

local_storage:
  get: services
  deploy:
    - deployId: default
facade:
  get: services
  deploy:
    - deployId: default


? Do you want to deploy all of these services? Yes
Going to upload module: local_storage
Going to upload module: facade
Module 'facade' was uploaded
Module 'local_storage' was uploaded
Now time to make the blueprint...
{
  "blueprint_id": "6b02209e6ab28e320cf297b616196678623ea3e2f7728e5614145000e00e72b3",
  "service_id": "9406d441-984b-4a3f-80e9-954a2bb49950"
}
Deploying:
  service: local_storage
  deployId: default
  on: 12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm... done
Going to upload module: local_storage
Going to upload module: facade
Module 'facade' was uploaded
Module 'local_storage' was uploaded
Now time to make the blueprint...
{
  "blueprint_id": "6b02209e6ab28e320cf297b616196678623ea3e2f7728e5614145000e00e72b3",
  "service_id": "a47cf4c8-b7ff-4403-9448-7dc7d370a494"
}
Deploying:
  service: facade
  deployId: default
  on: 12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e... done

Currently deployed services listed in ~/localdev/local-storage/.fluence/app.yaml:

local_storage:
  default:
    - blueprintId: 6b02209e6ab28e320cf297b616196678623ea3e2f7728e5614145000e00e72b3
      serviceId: 9406d441-984b-4a3f-80e9-954a2bb49950
      peerId: 12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm
      keyPairName: auto-generated
facade:
  default:
    - blueprintId: 6b02209e6ab28e320cf297b616196678623ea3e2f7728e5614145000e00e72b3
      serviceId: a47cf4c8-b7ff-4403-9448-7dc7d370a494
      peerId: 12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e
      keyPairName: auto-generated

@shamsartem shamsartem marked this pull request as ready for review February 20, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants