Can I get rid of MySql container completly - ddev

With DDEV, I'm developing with Laravel a project and I use Sqlite for local so I don't really need a proper Database available.
Is there any way to take out of formula the db container completely?
My final goal is to save battery usage.

Of course. Set omit_containers: [db,dba] in either your project or global configuration. ddev config --omit-containers=db,dba
Docs at https://ddev.readthedocs.io/en/stable/users/extend/config_yaml/

Related

Baseline existing database

Im looking at Sqitch and so far it seems like a great tool, however I have an existing project that I want to use it with, Is there a way to create a baseline?
For example, I take a backup of my schema then add it to the deploy script, I then want to run a command that will not run the this script on the database as it already exists, but would apply everything after this point?
I need the full base schema in there so that we can re-deploy the whole schema if required
You can use the --log-only option of sqitch deploy command
From the docs: https://sqitch.org/docs/manual/sqitch-deploy/
--log-only
Log the changes as if they were deployed, but without actually running the deploy scripts. Useful for an existing database that is being converted to Sqitch, and you need to log changes as deployed because they have been deployed by other means in the past.

migrate Strapi project from sqlite to postgres

I've got a local strapi set up with sqlite. I didn't think ahead, sadly that I would need use postgres to deploy to Heroku later.
After struggling to deploy with the project using sqlite, I decided to create a new project using postgres and successfully deployed it to Heroku. Now, in the local project, I've already setup content types, pages and everything. I was wondering, instead of having to recreate what I have done locally, how do I copy what I've done to the new project on Heroku including the database (sqlite --> postgres).
Has anyone done this before or maybe could point me to the right direction?
thank you in advance!
According to this:
https://github.com/strapi/strapi/issues/205#issuecomment-490813115
Database migration (content types and relations) is no longer an issue, but moving existing data entries from one database to another is.
To change database provider, I suppose you just need to edit config/environments/**/database.json according to Postgres setup.
Faced same issue, my solution is to use new project to generate a core for PostgreSQL and then run your existing code base on freshly created PostgreSQL:
npx create-strapi-app my-project and then choose custom -> PostgreSQL (Link)
When manually create a collections that are exists in SQLite, without fields
Run your old codebase with new database config which point on a PostgreSQL (that will create fields that you have in your data models)
Require a little bit of manual work, but works for me. Good luck!

Strapi - how to migrate content

I'm looking to use Strapi for a client of mine and I was wondering if there were best practices to migrate content from one environment, for example staging to production? My client has a lot of content, so recreating all the content on each environment is not viable.
Thanks a lot !
For now, the only raw solution is to dump your database ...
I think that the best option is to create a module that let you import/export content.
But keep in mind that migrate content between environment is never the best option. Your client probably want to see only the final state, but you probably want test content that use every spec' of your app.

How to create Docker image,Dockerfile of LAravel application from existing docker environment for Laravel

I have dockervel environment ,docker container for Laravel , and I really struggled to make it work on my machine.
The way I used the dockervel image is described here http://www.spiralout.eu/2015/12/dockervel-laravel-development.html
I have developed an application including Behat for BDD and PHPUnit testing in this environment and I have to make an image from it and say how to use It. I am confused how to create Dockerfile ?
any help is appreciated
This is NOT the answer to your question but I had bit of struggle with dockervel as well and thought of simplifying the docker implementation for Laravel projects.
The result is https://github.com/purinda/docker-laravel
This gives you ability to easily communicate with Laravel CLI commands such as artisan and running unit tests through phpunit in a the docker environment using multi-container environment.
First of all, dockervel is not a single image. It consists of sevelar images orchestrated together by docker-compose (see docker-compose.yml). And the reason for that is that you don't need all the parts every time (eg. you don't load nodejs when all you want is to work with artisan). Also you can change parts (eg. you can change MySQL with Postgres).
If you want to share your project, the easy way is to share the entire dockervel folder (please omit the node_modules folder, you can recreate it with dcomposer install, as also the database folders).
If you realy want to make it a single dockerfile (not so good idea) you should combine each dockerfile into a single one and you will end up with a huge and not flexible container.

Laravel Restore a Backup

I'm fairly new to server administration. I have my Laravel app up and running and I want to make sure it has proper backups. I have researched some backup packages and I have settled on https://github.com/spatie/laravel-backup.
However, once the server fails, I need to know how to use the most recent backup (which will be on AWS S3) to restore the database on the rebuilt server. Are there any suggestions for guides on how to do this? I can't seem to find any unless it doesn't really require much learning and instead just a couple mySQL commands.
Thanks!
I would use replication and within Laravel i would try to switch connection to the replica database server so things can run smoothly until the problem is resolved.
Take a look at this Cross-Region Replication
A typical production environment is automatically running backups on most important things that your deployment needs in order to recover from a failure. Those parts would commonly be your database and storage folder, and configuration files.
Also when you deploy a laravel application there aren't many things that are "worth" backing up , you can choose the entire disk to be mirrored somewhere or you can schedule a backup script which run every N times and backups the things that are more important to your application.
Personally i wouldn't rely on an package from laravel to handle my backups , you can always use other backup utilities, replication and so on.
Update
Take a look at the link below:
User Guide » Amazon RDS DB Instance Lifecycle » Backing Up and Restoring
Backing Up and Restoring
You can call the API function RestoreDBInstanceFromDBSnapshot as showed on example.
But i don't think something automated exists that would auto restore or magically make everything work, you need to do a lot of security checks if something like that would even be attempted. Final word i believe a good solution manually entering or sending the request would be the most solid solution.

Resources