How can I separate my flutter firebase/firestore implementation and providers to a independent package or library? - firebase

Currently, I am developing a flutter web app using Provider and Firebase. I would like to develop others apps (for example and admin console) with the same database and data providers.
My app currently have the following folders
my_app
- models
- providers
- services (firebase/firestore crud)
- pages
- utils
- widgets
I would like to have models, providers, and services as a local package or library. Something like:
my_lib
- models
- providers
- services
my_app
- pages
- utils
- widgets
my_other_app
- pages
- utils
- widgets
First, I don't know how to create a local lib, and how to make it a dependency of my_apps.
Second, since I will be using Firebase and Firestorage on my_lib, I don't know how the instances initialized in main are used by the package. Is it enough to initiate the global variables on the my_lib?

In your project folder you can create a folder packages and then create your 'packagesusingflutter create --template=package my_package`,
Have your app can depend on it in pubspec.yaml
my_package:
path: ../packages/my_package
in this case you will have
- my_project
-lib
-packages
- my_package
This works well when its just your app depending on the packages.
If you need to access your packages in different projects you can use github/gitlab to host your packages .
Say you have two repos that need to share a private package, my_app and my_admin , you can create a new repo my_packages and have your packages in it I.E
- my_packages
- package1
- package2
in your apps you can now depend on the packages using git eg
package1:
git:
url: git#github.com:username/my_packges.git
ref: main // branch
path: ./package1 //package name
package2:
git:
url: git#github.com:username/my_packges.git
ref: main // branch
path: ./package2 //package name
For github you need ssh key

Related

How to modify a Jelastic installation when wrapping a jps manifest in my own manifest?

The Jelastic Marketplace is full of interesting software. However, sometimes, they do not comply to my security needs. In those cases, I would like to write my own manifest that would install the manifest from the marketplace and add up the components that I need for my use-case. Let's take an example: I would like to wrap the kubernetes installation with the addition of a load-balancer. I would like to do something like this:
type: install
name: My Example Manifest
onInstall:
- install:
jps: https://github.com/jelastic-jps/kubernetes/blob/1.23.6/manifest.jps
envName: env-${fn.random}
settings:
deploy: cmd
cmd: echo "do nothing"
topo: 0-dev
dashboard: general
ingress-controller: Nginx
storage: true
api: true
monitoring: true
version: 1.23.6
jaeger: false
- addNodes:
- nodeType: nginx-dockerized
nodeGroup: bl
count: 1
fixedCloudlets: 1
flexibleCloudlets: 4
The issue I am having here is that the manifest cannot add the nodes, because of the following error:
user [xyz] doesn't have any access rights to app [dashboard]
What am I doing wrong? How can I make this manifest work? I tried to set user: root in the addNodes function but it doesn't help.
Of course, I am interested in suggestions involving one single install manifest. I know I could make it happen by first installing the kubernetes manifest and then running an update manifest that would add my load-balancer nodes. I would like, however, to package the whole thing within one single step, as described by my manifest above.

How can I set up a Bitbucket and SonarCloud integration for a Xamarin.Forms project?

Disclaimer: I do have almost no knowledge with DevOps, containers and CI/CD pipelines and it's something I'm learning on the fly.
I currently have a private Xamarin.Forms project hosted on Bitbucket, and I've created a SonarCloud account that I want to use to analyze the code within Bitbucket. From what I was able to gather from the SonarCloud onboarding process I need to setup a build pipeline within Bitbucket.
This is a code snippet of what SonarCloud says that I need to use within the bitbucket-pipelines.yml file:
image: ************************** # Choose an image matching your project needs
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- ************************** # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html
- sonar
script:
- ************************** # Build your project and run
- pipe: sonarsource/sonarcloud-scan:1.0.1
- step: &check-quality-gate-sonarcloud
name: Check the Quality Gate on SonarCloud
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.3
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
master:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
I've read and re-read the https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html article, but I wasn't ablet to gather much information. Seems like a rabbit hole with links to another articles that don't seem like they will be able to get me where I need.
So, a the moment my major doubts are:
Can a Bitbucket pipeline build Xamarin.Forms projects? (Android and iOS)
If so, how can I set up a bitbucket-pipelines.yml in order to allow that?
If not, should I go to Azure Devops or some other platform that will allow me to do that and integrate with SonarCloud?
I'm already using Visual Studio App Center to build the Android and iOS app (integraged with Bitbucket). But it seems like the AppCenter can't be natively integrated with SonarCloud.
Can anyone help me with that?
Attaching a sample working bitbucket-pipelines.yml file for reference
image: node:10.15.0 # Choose an image matching your project needs
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- node # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html
- sonar
script:
- npm install
- pipe: sonarsource/sonarcloud-scan:1.2.0
- step: &check-quality-gate-sonarcloud
name: Check the Quality Gate on SonarCloud
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.4
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
custom: # defines that this can only be triggered manually or by a schedule
staging: # The name that is displayed in the list in the Bitbucket Cloud GUI
- step:
script:
- echo "Scheduled builds in Pipelines are awesome!"
- step:
name: Build, test and analyze on SonarCloud
caches:
- node # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html
- sonar
script:
- pipe: sonarsource/sonarcloud-scan:1.2.0
- step: &check-quality-gate-sonarcloud
name: Check the Quality Gate on SonarCloud
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.4
branches:
master:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
Pipeline file is used to create a small container in bitbucket infrastructure and runs the code analysis there.
This file provides information regarding
When all checks should run
What all checks should be done.
Configuration of the image and container which will be created to run the pipeline.
Cache configuration for faster builds.
Reusable build-level code components like steps etc.
bit bucket docs for reference
https://support.atlassian.com/bitbucket-cloud/docs/get-started-with-bitbucket-pipelines/
https://support.atlassian.com/bitbucket-cloud/docs/pipeline-triggers/
https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/
https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/

Cloudify Agent installation

I was trying getting hands on Cloudify deployments and learnt of cloudify agents lately which are required to do vm configurations.
I was reviewing the following plugin :
https://github.com/cloudify-cosmo/cloudify-cloudstack-plugin/blob/master/plugin.yaml
and am particularly trying understand the agent installation method here.
From what I understand so far, any plugin to be used in the blueprint or .yaml files being imported, should be imported or defined.
The above plugin.yaml file includes the below node :
cloudify.cloudstack.nodes.WindowsServer:
derived_from: cloudify.cloudstack.nodes.VirtualMachine
interfaces:
cloudify.interfaces.worker_installer:
install:
implementation: agent.windows_agent_installer.tasks.install
inputs: {}
start:
implementation: agent.windows_agent_installer.tasks.start
stop:
implementation: agent.windows_agent_installer.tasks.stop
inputs: {}
uninstall:
implementation: agent.windows_agent_installer.tasks.uninstall
inputs: {}
restart:
implementation: agent.windows_agent_installer.tasks.restart
inputs: {}
cloudify.interfaces.plugin_installer:
install:
implementation: agent.windows_plugin_installer.tasks.install
inputs: {}
I want to understand how the agent plugin is being used here as
implementation: agent.windows_agent_installer.tasks.start
if no traces of importing that plugin are there in the yaml file.
Any thoughts are welcome.
Thanks
I think you are confusing the terms.
A plugin — an extension of Cloudify Orchestrator.
An agent — a service running on a VM created by Cloudify to run tasks on it.
If you want to use the CloudStack plugin, you should import it at the beginning of your blueprint, as in:
imports:
- https://github.com/cloudify-cosmo/cloudify-cloudstack-plugin/blob/master/plugin.yaml
You didn't mention the Cloudify version you are using, but if you are using the latest version (4.6) or any version > 4.2, you should upload the plugin to the manager before using it, and then import it via:
imports:
- plugin:cloudify-cloudstack-plugin
The agent installation process could be done in several ways, you can follow the documentation here and choose the best method for you.
The default method is remote and it would be done via SSH or WinRM.
You can look at this example for agent installation on Windows.

How to use the extension modules in saltstack from Git repository?

I have one extension python module in Git repository, named compute_pillar.py.
I want to use this as an external pillar, below are my extension_module settings:
extension_modules: /var/cache/salt/master/gitfs
gitfs_ssl_verify: False
gitfs_provider: gitpython
gitfs_remotes:
- git#git.corp.company.com:Saltstack/saltit-automation.git:
- root: salt
- base: master
- file:///var/cache/salt/master/gitfs
Below is my pillar.conf:
ext_pillar:
- cmd_json: 'echo {\"arg\":\"value\"}'
- compute_pillar: True
Now when calling pillar.items, it calls the cmd_json as it is local, but for compute_pillar it never executes, below is the error message in the log:
[salt.utils.lazy ][DEBUG ][24791] Could not LazyLoad
compute_pillar.ext_pillar: 'compute_pillar.ext_pillar' is not
available. [salt.pillar ][CRITICAL][24791] Specified ext_pillar
interface compute_pillar is unavailable
What is the configuration setting to call the extension modules directly from git repository?
You do not need to point salt to /var/cache/salt/master/gitfs.
Assuming your gitfs backend is configured properly and working, create a directory called _modules under salt directory (for example for roots backend /srv/salt/_modules) and put your extension python module here, push to git, wait 60 seconds or run salt-run fileserver.update.
Now just sync your minion salt minion_A saltutil.sync_all and you should be able to use the module.

Meteor app can't find routes

New to meteor. Just cloned a git repo, and upon launching the app, I get a router.js:347 There is no route for the path: / error.
This is my route for root in imports/startup/client/routes.js
FlowRouter.route('/', {
name: 'Home',
action() {
BlazeLayout.render('app_body', {tabs: 'tabs', inbox: 'inbox', upload: 'upload', invite: 'invite'});
console.log('root loaded');
},
});
Here is the list of packages
accounts-facebook 1.0.10 Login service for Facebook accounts
accounts-password 1.2.14* Password support for accounts
alanning:roles 1.2.15 Authorization package for Meteor
aldeed:collection2 2.9.1 Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema 1.5.3 A simple schema validation object with reactivity. Used by collection2 and autoform.
arillo:flow-router-helpers 0.5.2 Template helpers for flow-router
blaze-html-templates 1.0.4 Compile HTML templates into reactive UI with Meteor Blaze
check 1.2.3 Check whether a value matches a pattern
dburles:collection-helpers 1.0.4 Transform your collections with helpers that you define
ecmascript 0.5.7* Compiler plugin that supports ES2015+ in all .js files
email 1.1.16* Send email messages
es5-shim 4.6.13* Shims and polyfills to improve ECMAScript 5 support
hpx7:youtube-iframe-player 0.4.15 Control YouTube's embedded player using Meteor
http 1.2.8* Make HTTP calls to remote servers
jazeee:spiderable-longer-timeout 1.2.13 Extended spiderable package: SSL, caching, longer timeout, no stdin issues, publish flag
jchristman:tagsinput-autocomplete-edited 1.1.0+ A combination of the mizzao:autocomplete library and a tagsinput-like functionality
jquery 1.11.9 Manipulate the DOM using CSS selectors
kadira:blaze-layout 2.3.0 Layout Manager for Blaze (works well with FlowRouter)
kadira:flow-router 2.12.1 Carefully Designed Client Side Router for Meteor
keepnox:perfect-scrollbar 0.6.8 Perfect-scrollbar packaged for meteor
manuel:reactivearray 1.0.5 Reactive Array for Meteor
matb33:collection-hooks 0.8.3* Extends Mongo.Collection with before/after hooks for insert/update/remove/find/findOne
meteor-base 1.0.4 Packages that every Meteor app needs
meteorhacks:aggregate 1.3.0 Proper MongoDB aggregations support for Meteor
mobile-experience 1.0.4 Packages for a great mobile user experience
momentjs:moment 2.14.4 Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging
mongo 1.1.10* Adaptor for using MongoDB and Minimongo over DDP
reactive-dict 1.1.8 Reactive dictionary
reactive-var 1.0.10 Reactive variable
sacha:spin 2.3.1 Simple spinner package for Meteor
saucecode:timezoned-synced-cron 1.2.11 Fork of original w/ timezone support. Define and run scheduled jobs across multiple servers.
session 1.1.6 Session variable
spiderable 1.0.13 Makes the application crawlable to web spiders
standard-minifier-css 1.1.8* Standard css minifier used with Meteor apps by default.
standard-minifier-js 1.1.8* Standard javascript minifiers used with Meteor apps by default.
tomwasd:flow-router-seo 0.0.3 A simple way to set the title and meta tags for sites using flow router
tracker 1.1.0 Dependency tracker to allow reactive callbacks
twbs:bootstrap 3.3.6 The most popular front-end framework for developing responsive, mobile first projects on the web.
What is it that is causing the app not to find the routes file? I have looked through the following posts for some guidance, but have found none.
Meteor Routing Error : There is no route for the path: /
https://github.com/kadirahq/flow-router/issues/608
https://github.com/kadirahq/flow-router/issues/185
http://coderchronicles.org/2016/04/08/getting-started-with-meteor-1-3-react-and-flowrouter/
Any help solving the problem would be appreciated. I feel like I'm missing something simple.
-S
**project file structure
imports/
startup/
client/
index.js
routes.js
server/
fixtures.js
index.js
api/
server/
publications.js
ui/
components/
layouts/
pages/
client/
main.js
head.js
main.js
server/
main.js
fixtures.js
server-global.js
Are you importing the routes file into your app's main container?
For example, if you have a /client/main.js file that gets loaded from client side at startup, then it should include the import reference to routes file as follows:
import '/imports/startup/client';
Or, import '/imports/startup/client/routes.js';
Put your route file in 'imports/starup/lib' (lib - for example). In fast-render package recommended use 'lib', if you wanna use it. If no - 'client';
Then make sure you imported your route file in 'root/client/main.js';
Please, read this part of docs: https://guide.meteor.com/structure.html#javascript-structure
It is very helpful article.
UPD:
Please, remove duplicate files in your client/main.js
When, in client/main.js
import '/imports/startup/client';
In your imports/startup/client/index.js
import './routes.js';
And now it will work.
Dont forget, you must import all views you wanna use in your route.
Problem fixed. Instead of launching with meteor run, need to launch with meteor --settings settings.json --production

Resources