My Strapi (deployed on Heroku) deletes all it's data, even administrator - vue.js

Im creating a vue app and Im trying to fetch data from this Strapi api to my VueJs app, but everything on Strapi gets deleted after a few hours. Does anyone have a solution to this?

So everytime Heroku cycles it's Dynos, your data will disappear. That is because Heroku doesn't allow for the file system to have changes made. However, you can use their mLab add on to use MongoDB or host your database on MongoDB Atlas (which is what I use). Then for media, you will need to use an external provider like AWS S3.

Same thing kept happening to me... I had to switch to Mongo DB. You can also use Cloudinary for media

Related

How do I manage multiple static files between environments (admin uploaded)?

I building a new course-like web application. There will be plenty of images, video and sound files.
I am wondering about possible strategies for static file management between app environments.
My current approach is to use SQL database to store image urls, which will be uploaded via admin panel on the website. The images are to be stored in a blob-like storage (AWS S3 bucket).
This however, when doing changes, requires to upload the image to each environment or create a data migration dev -> staging -> prod in a deployment pipeline.
Am I missing something here? Even if I store files in a single place (single storage account) for all environments, I still need to migrate the database records when making changes to the course.
Should I just apply the changes in prod and create some basic migration data for dev/uat course testing?.
To emphasize, files will only be uploaded by an admin, not by a user. For example, admin uploads the image via admin panel and the image will be automatically included in the course.
I am not sure what's the appropriate way of doing this to manage and test changes properly. If I allow to do this on prod directly without migration, then I'm running the risk of uploading something invalid into the course with untested changes. On the other hand , I am not sure if it's common to migrate SQL data between databases and it will also have it's own pitfalls.

keystone without any database?

after I setup keystone I run it using node keystone. Here I received error that I have to set up a db. I don't wan't any thing like that. I'm going to save all my data in a multi-chain server. how can I instruct that I don't need a data base connection and run node keystone.
KeystoneJS requires MongoDB, it's a prerequisite for creating a Keystone project.
I'm unsure what you mean by "multi-chain server", but it doesn't sound like KeystoneJS is the right tool for you.

Parse server account key

Installed Parse Server on Digital Ocean, and have been trying to use the CLI to manage cloud code. I've hit a wall, since the CLI tool will not move forward without an account key on Parse.com (which no longer offers account keys). For example, if I type in "parse new", I get this:
We've changed the way the CLI works. To save time logging in, you should create an account key. Type "parse configure accountkey" to create a new account key. Read more at: https://parse.com/docs/cloudcode/guide#command-line-account-keys
If you actually do that, it responds:
Input your account key or press ENTER to generate a new one. NOTE: on pressing ENTER we'll try to open the url: "https://www.parse.com/account/keys" in the default browser:
This leads to a login page. Since I don't have an account on Parse.com (nor should it be necessary for Parse Server), I'm stuck. If I click on the "I don't have an account" link, it just takes me to the front page.
I find it hard to believe that there's no way to manage/create cloud code on Parse Server. But, it is sure looking that way. Is this just a failure to update the CLI or am I missing something obvious.
Many thanks.
Parse cli is not meant to be used with parse server. At least not currently. Parse server is simply a node module which means that you will have to handle deployment etc yourself. There are many tools that will handle everything that the parse cli did, and much more, from the nodejs community however.
You said that you used digital ocean. You might want to consider heroku, aws or google cloud. Heroku for example has the heroku cli with many of the same features as the parse cli which might save you some time.
You can't use parse cli on parse-server. Parse-server and parse.com environment are both different , parse-server is just the node module so deployment can be automated using other tools.
I am using forever to restart my parse-server automatically when a file changes. So you can just copy/paste your files using filezilla and that's it.

File upload w/ expressjs v4.+

I am trying to move to express 4.+ and I am having trouble figuring out what I should do about file uploads.
Migration docs says I need to come up w/ an alternative but they don't really give an example. They also dropped support for a reason, which file upload package should I use?
Also read that you should not attach a form upload to every post by using:
app.use(multer(...));
Is there a good way to attach these to just a particular route?
formidable or busboy are options.
Expressjs 4.+ has lost this feature because it's not built on top of connect anymore.
I use connect-busboy. I could not get 'busboy' to work. Other packages I came across but have never played with are 'flow' and 'parted'. There is also a npm package 'mongoose-file' which seems to let you add a file upload path to a mongoose Schema for upload to server. It may be handy if you are uploading other data to a MongoDB?
Basic connect-busboy and Formidable example using Express V4.2:
Node/Express file upload

Heroku Photos stored on server

I use my server to store user uploaded pictures. This is great however when I make a change to the code it reflects this and deletes my pictures stored on the server.
git push heroku master
How do I prevent this?
Heroku's filesystem is read-only so you can't and shouldn't store uploaded files in your dynos.
If you think about it, it makes sense. You can have multiple dynos running your app so you can't guarantee which dyno is receiving the pictures.
Dynos should be stateless anyway, so you can easily scale your application up or down.
The preferred way to do file uploads on Heroku is to use Amazon S3 as outlined in their DevCenter.
Like leonardoborges Heroku's filesytem is read-only. Since you are using rails you can use a gem like carrierwave that helps when you are handling images in your app and it is easy to set up with Amazon S3.
Other helpful links
Carrierwave Railscast