how to add mongodb existing json data to meteor application? - meteor

I have a meteor project folder and one more folder with mongodb json files. Now how will i install these files to my meteor application so that the mongodb collections gets created automatically.

Run the following command in your project folder, Be sure to run the meteor project in another terminal
mongorestore --host 127.0.0.1 --port 3001 --db meteor path_to_mongodb_json_folder
this command will allow to restore the collections in your project

Related

How do I add a webjob to my aspnet appservice using only the CLI

I am working on macOS with an external text editor (NOT VisualStudio).
I have an asp.net project that I push to my app service using
git push azure main:master
the remote is configured as such https://$name:pass#name.scm.azurewebsites.net:443/name.git
when I go to the web jobs section in the app service to add a web job, I get the error message:
I want to continue using my source control push method while developing...
however I would also like to add a csharp console webjob .
I have followed the tutorial here (A) https://learn.microsoft.com/en-us/azure/app-service/webjobs-sdk-get-started, and have a functoining console app that consumes a message from a queue.
How can I push this extra console app to my Kudu instance?
I read here that there is a 'hidden' structure not in the main doucmentation (A) I linked above for the tutorial: https://github.com/projectkudu/kudu/wiki/WebJobs.
Do I have to manually zip the result of dotnet publish -c Release to some Kudu folder? Or is there a more elegant way by somehow including this project inside my git repo that I push normally... or using an az cli tool to push the webjob to the app?
I created the Web Job and tried to Add it from App service, got the below error.
Using Azure CLI, we can deploy our Web Jobs to App Service
Web Jobs need to be deployed to the below folder in KUDU Console, Create a folder with Web Job Name in the below path
app_data\jobs\triggered\NewFolder
Zip all the contents of the Web Job into one folder.
wwwroot folder path will be read-only mode, we need to enable it by setting WEBSITE_RUN_FROM_PACKAGE to 1
Set the WEBSITE_RUN_FROM_PACKAGE to 1 in WebApp => Configuration => Application Settings or run the CLI command to set it.
az webapp config appsettings set --resource-group YourRGName --name AppServiceName --settings WEBSITE_RUN_FROM_PACKAGE="1"
Zip deploy Web Job to the existing Azure App service
az webapp deployment source config-zip --resource-group YourRGName --name YourAppService --src YourZipFilePath
We can directly drag and drop the Web Jobs Zip folder from the KUDU Console as well
We can deploy our Web Jobs in many ways.
We can FTP / Use Build Pipelines/ Zip Deploy.
Found a way to push directly using az cli
az webapp deploy --name $APP_NAME -g $RG \
--src-path program.py \
--type static \
--target-path /home/site/Jobs/continuous/Job$RANDOM/program.py
for larger programs in .net I just dumped the project on Kudu, unzipped, and rebuilt (I'm on a mac m1 so can't build against x64 without some hoops, this was easier workaround)
# on my machine
az webapp deploy --name $APP_NAME -g $RG \
--src-path path_to_dotnet_project.zip \
--type static \
--target-path /home/site/Jobs/continuous/Job5/myproject.zip
then on the app service (using kudu cmd/powershell)
cd /home/site/Jobs/continuous/Job5
unzip myproject.zip
dotnet build -c Release
cp bin/release/net6.0/* /home/site/Jobs/continuous/MyNewJob
#job in MyNewJob automatically starts since this is in the 'continuous' folder

How do I read a file from the local file system from inside a meteor app?

I have a meteor app that needs to periodically read a file located on the host's file system, outside of the app package. I am using node's fs to accomplish this, and it works fine on my (macOS) development machine.
However, when I run mup deploy to deploy it to my (Ubuntu 14) server, mup returns the following error after starting meteor:
Error: ENOENT: no such file or directory, open '/home/sam/data/all_data.json'
at Object.fs.openSync (fs.js:652:18)
at Object.fs.readFileSync (fs.js:553:33)
Does anyone know why this might be happening?
you should follow mup documentation closely. Have you seen volumes setup in mup config? Try this to solve your issue.
Reason: mup runs app in docker without any access to host file system unless specified. Volumes setup does this for you with mup deployment.
Below is the part of mup config from http://meteor-up.com/docs.html, Everything Configured, read more to get a better idea.
name: 'app',
path: '../app',
// lets you add docker volumes (optional). Can be used to
// store files between app deploys and restarts.
volumes: {
// passed as '-v /host/path:/container/path' to the docker run command
'/host/path': '/container/path',
'/second/host/path': '/second/container/path'
},
The user you have that is running your meteor build on the server needs to have access to that folder - read access. I would store the file in a different directory than the home one, because you don't want to mess it up. Either way doing something like chmod -R 444 /home/sam/data should give read access to any user for all files in that directory. You are probably running meteor as your local user(sam?) in development mode on your macOS, but the built up gets run as meteor or some other user on ubuntu, because of mup and forever.

Meteor helper for Visual Studio Code: what is a meteor project directory

I am trying to use Visual Studio Code as an alternative to Webstorm to edit and debug a toy Meteor app. After installing the MeteorHelper extension which is announced as provided "Meteor CLI integration into VSCode" and try to run any Meteor command I get the error msg:
"X is not a meteor project directory, check your workspace definition".
I don't know whether the problem is the LOCATION of my directory X, or its CONTENT (something is missing?). I changed the meteorhelper.relativeProjectPath string in the settings.json file to various possible values to no avail.
Has anyone out there tried to use VSCode to edit and debug a Meteor app and got that error?
A Meteor project directory is what gets created when using the command:
meteor create my-app
This command creates a folder that contains your Meteor applications' code. Typically, the directory structure looks something like this:
my-app/
.meteor/
client/
imports/
server/
package.json
The error you're describing would be encountered while attempting to run a project-specific meteor command from outside of a Meteor project. In the above example, I would access the project directory by first entering
cd my-app
on the command line.

How to specify local npm modules in meteor packages

I have an application which uses a Meteor with npm module. So I have a packages/mymodule/package.js file which contains:
Npm.depends({my_npm_module:"my_npm_module_version"});
Upon lauching Meteor app, my_npm_module will be installed to packages/mymodule/.npm from npm repository. Now lets say I want to develop my_npm_module on my local machine. How can I force Meteor to use my local directory for my_npm_module, What should I do i my_npm_module source is modified?
If you have a local Npm module it may not be necessary to do this.
Simply use var module = Npm.require('<absolute path to npm module>'); anywhere on your server side.

Deployment with Password using Linux in Meteor?

How to deploy a app with password in meteor using linux. It's deploy good when with out set password.But i need to deploy app with password in meteor. I did but gets some error messages i didn't understand the following messages.So please see the below deployment process and suggestions me what to do?
[root#localhost myapp]# meteor deploy myapp.meteor.com --password
deploy: the --password option needs a value.
Try 'meteor help deploy' for help.
[root#localhost myapp]# meteor deploy myapp.meteor.com 123456
deploy: too many arguments.
Usage: meteor deploy <site> [--settings settings.json] [--debug] [--delete]
Deploys the project in your current directory to Meteor's servers.
You can deploy to any available name under 'meteor.com'
without any additional configuration, for example,
'myapp.meteor.com'. If you deploy to a custom domain, such as
'myapp.mydomain.com', then you'll also need to configure your domain's
DNS records. See the Meteor docs for details.
The --settings flag can be used to pass deploy-specific information to
the application. It will be available at runtime in Meteor.settings, but only
on the server. If the object contains a key named 'public', then
Meteor.settings.public will also be available on the client. The argument
is the name of a file containing the JSON data to use. The settings will
persist across deployments until you again specify a settings file. To
unset Meteor.settings, pass an empty settings file.
The --delete flag permanently removes a deployed application, including
all of its stored data.
Options:
--delete, -D permanently delete this deployment
--debug deploy in debug mode (don't minify, etc)
--settings set optional data for Meteor.settings
--star a star (tarball) to deploy instead of the current Meteor app
[root#localhost myapp]#
Perhaps you should use both command and option:
meteor deploy myapp.meteor.com --password 123456

Resources