CakePHP: Manage development and production environment - cakephp

I'm using cake php with an svn repository and i want to manage my app using
a development and production environment.
Is there a better way to do this than make 2 domain, 2 databases and merge files modified
from development to production?
Thanks

you can create two svn repositories ...one for development purpose another for production.
And while doing that you can have the same database for both of them or it can be different (that actually depends upon your personal requirement) and you can have a different domain for the two..you can manage the domains by defining the absolute urls in core.php of cakephp and similarly manage the database connection with database.php and can make different database.php and core.php for respective environments. Once you are done with the development phase you can export the whole code into production environment and can change your core and database files

Related

Is there a way to backup/export & import Strapi data

So I am at the place where I lost all of my Strapi data after moving from local to remote host and deploying my Strapi through herokuapp.com
I am using Strapi in my personal NEXT.JS project.
Luckily my Strapi database wasn't so huge and all content-types were kept so I was able to recreate the database quite quick. Also this was just a personal project.
I am wondering though, if I decide to push Strapi to use in in more professional context and in real project – how do I move from local development to deployment without loosing all data?
Is there a way to export everything before deployment and then import it into the deployed CMS or how does this work?
Also – what if I want to do it the other way around? I will keep working on my app using my Strapi on Heroku but at some point I will want to replicate the CMS locally. Where is the data stored and how do it get access to it?
From docs: "Strapi does not currently provide any tools for migrating or deploying your data changes between different environments (ie. from development to production). With the exception being the Content-Manager settings"
And there is no export/import content for now.
To export your data for example from the local environment to the production you have to handle:
content-types - Strapi store this stuff at files so version control will help
database data - you have to make database backup manually and then import data at the production server
static files - if you use Srapi to handle the static files you probably will have to copy them manually and import them to the production server or use version control for it (bad option). They are stored at app/public/uploads
I didn't tried this myself but it looks like a pretty tough task.
Conclusion: if it's OK for you to migrate only your content types, just put a git on your Strapi folder
You can do it via the CLI now, new from version 4.6.
Strapi supports export, import, and transfer.
To create a tar of your data:
npm run strapi export --file my-strapi-export
To import data into your project:
npm run strapi import -f export_file.tar.gz
There are more options in the docs:
https://docs.strapi.io/developer-docs/latest/developer-resources/data-management.html#export-data-using-the-cli-tool
With the new data export & import system, you can backup & restore
your Strapi project data without acting manually and directly into the
database.
More info: https://strapi.io/blog/announcing-strapi-v4.6
Keep in mind Heroku is in the middle of shutting down its free tier, so using another provider like railway.app or render.com might be a good idea.
Anyway: As Eugene already mentioned in his answer there are 3 types of data that might have to transmitted (content types, the actual database, and files).
After your first deployment to Heroku you should end up with all content types being there, but with an empty database and no files.
Following this guide you will create an own database while setting up your project where you can now either export and import your database from your local development environment (which you would have to do manually) or put in new data by hand. Sometimes this is even better since development environments tend to include a lot of "Lorem Ipsum" content for testing purposes.
Future deployments should not reset your database though but keep your data from that environment.
Finally there are the files which I would recommend to store on Cloudinary since it's free, and Strapi offers an easy-to-use plugin for it. Just create a free account on Cloudinary, install the plugin in your Strapi project, and set your ENV variables for your production environment within Heroku.
I found this
Apparently they recently did a plugin tutorial that had to do with this issue. There is a plugin called strapi-plugin-import-export-content on git hub that might be able to help your issue.
git hub link

Serving different Container Registry images for dev, test, prod within one GAE project

I deploy my Docker image to default GAE by gcloud app deploy --image-url=us.gcr.io
I have successfully mapped my custom domain to this application with custom runtime and flex env.
My dispatch.yaml sends requests to its sub-domain:
dispatch:
- url: "dev.domain.com/*"
service: default
Now I want to use different images from Container Registry for test.domain.com and domain.com
While having all these images sharing same Cloud Storage and Firebase credentials.
Being new to GCP I wanted to learn any simple approach to organize such basic structure without going into services and versions (just by assigning proper images to serve relevant domains).
Is it even possible to do within one GAE project or I should create separate projects for it?
Mapping custom domains can only be done at the service level, so if you don't want to go into services separate projects is your only choice.
Actually using separate projects instead of services (or service versions) for implementing different environments has some advantages, I'd choose separate projects, too. See Advantages of implementing CI/CD environments at GAE project/app level vs service/module level?
I'm not sure if sharing the storage and credentials between production and other environments is a good idea (what if something goes wrong?). I'd keep them separate, too (maybe with some jobs to populate non-production projects with production data, if you need to). But if you do want to share them across projects you'll probably need to make some extra steps.

how can I designe a workflow of continous integration for wordpress?

how can I use wordpress core for continuous integration/deployment. it seems wordpres completely work with database changes. it means when I change my local and users change production there is a conflict and need merge on db .
Continuous Integration with systems like Git and Bitbucket is for files only, and Wordpress does not use Schema Builders like Laravel. For database changes, you can simply export production and import to local before testing changes then push live, or you can look for schema modifiers like ApexSQL Diff

Configure MySql for various environments and deploy to Google App Engine via IntelliJ

I am using IntelliJ IDE to develop Spring Boot services with Maven and using Google Cloud Tools plugin to deploy to App Engine Flexible. While I use the following (to connect to local) and run the app. locally, it works fine (in application.properties).
spring.datasource.url=jdbc:mysql://localhost:3309/test
However, when I try to deploy to the GAE with the following (in application.properties),
spring.datasource.url=jdbc:mysql://google/test?cloudSqlInstance=[cloud-sql-instance]&socketFactory=com.google.cloud.sql.mysql.SocketFactory
when trying to build the project before uploading to GAE, it throws UnknownHostException: "google".
Questions:
How can I create different configurations for various environments (dev (local) / qa(gae) / production(gae) ) and deploy to those environments with the corresponding environment values?
When doing the build from the IDE, it validates the DB connection string (which points to the cloud sql instance) and throws an exception if it is not reachable (however it will be from the QA / Prod environment if the build is successful). How to resolve this case?
Any help on this would be greatly appreciated.
Thanks in advance.
You need to use Spring Profiles. Please read all the information in the documentation for an extensive explanation.
Briefly:
Spring Profiles provide a way to segregate parts of your application
configuration and make it only available in certain environments
Now, onto the problem at hand. It can be solved by introducing a "local" profile for you development and leaving the "default" profile to be used in production (GAE).
application.properties
# this file is for the "default" profile that will be used when
# no spring.profiles.active is defined. So consider this production config.
spring.datasource.url=jdbc:mysql://google/test?cloudSqlInstance=[cloud-sql-instance]&socketFactory=com.google.cloud.sql.mysql.SocketFactory
application-local.properties
# this file is for the "local" profile that will be used when
# -Dspring.profiles.active=local is specified when running the application.
# So consider this "local" development config
spring.datasource.url=jdbc:mysql://localhost:3309/test
# In this file you can also override any other property defined in application.properties, or add additional ones
Now to run the application while developing all you have to specify in IntelliJ in your run configuration is -Dspring.profiles.active=local under VM options, or if you're using a "Spring Boot" run configuration, you can just add local in the Active Profiles field.
And on GAE, do not specify any profiles at all and the defaults will be used.

can I change jsessionid cookie name on weblogic en masse

belatedly realised that hosting related applications on 2 separate weblogic clusters was not good news for users with multi tabbed browsers.
An answer I believe is to give the applications different jsessionid cookie. I understand this can be specified on an application basis in weblogic.xml, but this is going to be timeconsuming and error prone.
Is there any robust way to enforce this on all applications within a cluster?
You can override session cookie name (configured in your weblogic.xml deployment descriptor) using a deployment plan.
This allows you to use the default JSSESSIONID in all your apps in your development topology (usually just an Admin Server with all apps deployed) and customized your cookies names per app/cluster without editing your war file.
You can easily automate your deployments including your plan XML file as an extra argument in the deploy WLST command:
wls:/mydomain/serverConfig/Servers> deploy('App1',
'/apps/app1/App1.ear', targets='myserver', planPath='/apps/app1/plan/stage-plan.xml')
You can find an Oracle Tutorial about Deployment Plans and WLS 12c in
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/12c/09-DeployPlan--4464/deployplan.htm?cid=6114&ssid=4153751345526#top

Resources