Bluemix/CloudFoundry + Meteor - How to Project Reset? - meteor

When developing with Meteor locally, one execute meteor reset locally to refresh the database.
Can one run this command on a production level app deployed on Bluemix without digging into the Mongo console?

The meteor reset command actually deletes the local mongo database files in .meteor/local. Since the database isn't stored in the application container when running in Cloud Foundry, there isn't an equivalent operation as a one liner.
Seems like your only option is to retrieve the connection credentials from your application cf env appname and then stop the application, connect with the mongo command line, and use one of the methods described in this answer to clean your data out.

Related

How to delete AppEngine default service in the existing Google Cloud project with Firestore

I've the existing Google Cloud project that was created by Firebase and use Firestore in this project. Decided to try AppEngine and run Hello World Example in this project.
Now I want to delete this newly deployed AppEngine Service, but there are 2 problems:
1) Hello World Docs suggest to switch off the AppEngine. In this case Firestore is not working
2) Can't delete this service from CLI/UI as this service was deployed as the default one
Issue deleting service: [default]
The default service (module) cannot be deleted.
Is there a way to delete this service from the project and keep Firebase Firestore?
Go to App Engine -> Settings: https://console.cloud.google.com/appengine/settings
Click on "Disable application"
If there's nothing else on your project, you can shut down the project at https://console.cloud.google.com/iam-admin/settings.
2) Can't delete this service from CLI/UI as this service was deployed as the default one
See https://cloud.google.com/nodejs/getting-started/delete-tutorial-resources .
The only way you can delete the default version of your App Engine app is by deleting your project. However, you can stop the default version in the GCP Console. This action shuts down all instances associated with the version. You can restart these instances later if needed.
In the App Engine standard environment, you can stop the default version only if your app has manual or basic scaling.
As it's displayed in the UI on disabled Stop button:
You only can stop versions that are manually scaled, basic scaled or in flexible environment
The solution is to deploy another default service using flexible env, stop it and then delete the app with Standard env:
1) Change app.yaml:
runtime: nodejs
env: flex
2) Run gcloud app deploy
3) Stop new version using UI or CLI
4) Delete old version
tl;dr: Deploy a hello world app on the flexible environment to replace the default service, and then stop it. No need to delete because the default service cannot be deleted.
I assume that:
you wanted to delete the default App Engine service, but
you wanted to continue using Google Cloud Firestore in the same project.
Problems that arise:
you cannot disable Google App Engine without also disabling Firestore
you cannot delete the default service
you cannot stop the default service because it may be deployed to the standard environment using some scaling settings that doesn't allow stopping the instance
Workaround:
Deploy a hello world application to the flexible environment. You can do this in Google Cloud Shell.
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples
cd nodejs-docs-samples/appengine/hello-world/flexible
gcloud app deploy
Under Versions, stop the newly-deployed version and delete the old version.
Confirm that the instance count is 0.
So the service is not deleted; it is just stopped and doesn't charge you for instances. You can continue to use Firestore.

How to delete site via CLI

Is there a way to delete an app via Firebase CLI?
Our CI creates a temporary Firebase app for a feature branch (based on the CI build number), and then runs tests on it. At the end it needs to delete the app. I'm not entirely sure how this is done. firebase disable:hosting just disables hosting and does not delete the app. This is similar to how we would have used Heroku review apps or Heroku forked apps. A similar CI workflow can also be achieved on Google App engine via versions.
Any pointers would be much appreciated.
The correct command is firebase hosting:disable, which make your site offline. You can not remove your project, instead you can overwrite it by creating a new one with firebase init.
More info here https://firebase.google.com/docs/cli/.
There is currently no public API to delete a Firebase backend.
The recommended practice is to use the same database for testing and (if needed) put each run in its own node under the root. So instead of creating/deleting a new database, you're just create/deleting a node in a single database.
Using the command firebase use <alias> --unaliasand then delete the project from the console https://console.firebase.google.com/
Check before the list of commands with the command -h

Local development with remote database hosted by meteor.com

I develop Meteor application on my local computer, and deploy it to meteor.com. I want to have an opportunity to use remote production MongoDB database for local development.
So, I get url to my DB with meteor mongo --url myapp.meteor.com, then I add it to my MONGO_URL environment variable:
export MONGO_URL=mongodb://client-5345a08c:5f63edff-8cec-a818-7f35-c05021bb6d91#production-db-d1.meteor.io:27017/34377_ru
The inconvinience is that this url is invalid in one minute, so I need to generate another one and modify my MONGO_URL every time I want to start my application. I suspect some permanent url to my MongoDB is out there. I ran meteor mongo myapp.meteor.com and noticed greeting:
MongoDB shell version: 2.4.9
connecting to: production-db-d1.meteor.io:27017/34377_ru
I tried to use this url:
export MONGO_URL=mongodb://production-db-d1.meteor.io:27017/34377_ru
and even
export MONGO_URL=mongodb://myneteorcomusername:mymeteorcompassproduction-db-d1.meteor.io:27017/34377_ru
but I had no luck.
Are there ways to simplify my workflow and make meteor use my remote database by default?
I guess for scaling purposes, there is no dedicated mongo ever for each subdomain. I could be wrong so better ask this question over at the Meteor Talk Google group.

How to reset a meteor project thats been deployed with meteor up

I have used meteorUp here sucesffuly to deploy my meteor project on my own host.
However I have no idea how to reset the database, or the entire project itself, like I can locally with the simple meteor reset command. I tried installing meteor on the server but there is no .meteor project so that command doesnt work. I looked in /opt/meteor folder but no meteor project exists.
If you need to reset the data. You need to login to the server. login to mongodb with mongo meteor.
Then do db.dropDatabase() to delete the DB.
If you need to change the app, simple redeploy should work.
BTW: Do you not use MongoDB this way for a production app.
If you are using mup or mupx try:
Login to your server:
$ ssh <user>#<server-ip>
Login into mongo shell
$ docker exec -it mongodb mongo <app-name>
Drop db
> db.dropDatabase()
Is this what you are looking for?
mup reconfig
Based on the doc for it:
This will also restart the app [without re-deploying], so you can use it for that purpose
even if you didn't change the configuration file.
I don't have enough points to comment yet, but to add onto Arunoda's response, you might want to
use [name of app database]
before you
db.dropDatabase()
And if you don't know what the name is you can also
show databases
If you used mup, the database will generally be the same name as your app.

meteor in PROD, deploying live code changes

What is best approach to have live code changes deployed to PROD.
So that
i don't have to restart my servers.
And don't want to push the entire bundle.tgz file
What are the options ??
We have a Meteor app in production - We upload the new bundle and prepare it (updating the native fibers) and restart - you have to restart the node thread.
You might say that you kick all clients, but Meteor is build to handle poor connections and will reconnect - it uses delay algorithm to help flatten out reconnects.
If the client is ready for migration the new code is then pushed.
Our app is running Meteor inside cordova and we use appcache making sure that clients can allways open our app even if offline.
NOTE: MDG is working on Galaxy - a cool and easy way of managing your own Meteor servers - so deployment would be a single line in a terminal. (eta aprox. first part of 2014)
Easy deployment to your own server (DigitalOcean, Amazon EC2, etc) can be done using meteoric.
Meteoric can setup your server and deploy latest commit to production.
I use it and it works great.

Resources