How to go into production? |
Hello everyone,
I am an old developer, and for the past 10 years I've grown accustomed to downloading CI3, unzipping it, doing my stuff, then dragging the folder into an FTP server and voila! my project was live. Right now with CI4 it is a bit more complicated, I have a development site, what should I do to take my project into production? It seems over time developing has become more complicated (which is good), but what is the fastest way to take my code and send it into production? Thank you for your answer.
The official site is deployed by GitHub Actions and SSH (rsync).
When the `master` branch is updated, it deploys automatically. See https://github.com/codeigniter4projects/...deploy.yml
@Riji if i elaborate on your questions is it :
what should be my directory structure on live hosting in terms of if i physically have webs from sub directories in main hosting or my main hosting is for Ci4 only How do i get my dev code to main hosting what do i need to do in terms of config ? whats your approach to https ? i have http for my development ,i guess you also have . Are you Ok with https and editing in CI4 to take account of https. I just use lets encrypt from cpanel and edit .htacces fiel in public On your live are you using sub domains or CI4 is to be used for main hosting space ? In my main hosting space i physically have sub-directories ; one sub-directory is called andrinadesignstudio.com the structure of CI4 is : So i just go into dev , i zip up the 4 directories app.public,vendor and writable then i use cpanel to upload them to the sub-irectory. I use cpanel to extract each one. In my case i use sqlite as a database ; if there is data in the sqlite file , it doesn't matter it still gets up to server and works. Then i just point my domain at my hosting ; from cpanel i manage my domain and edit so that document route is pointing to public directory. Only other tweaks are use cPanel to install lets encrypt ; edit of .htaccess in public to take account of http->https ; if your using .env edit Code: CI_ENVIRONMENT = development to Code: CI_ENVIRONMENT = production i think thats about it .htacces in public will be one of these 2 lines depending whether http or https Code: RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] (01-24-2024, 07:00 PM)kenjis Wrote: The official site is deployed by GitHub Actions and SSH (rsync). Thank you for your answer. But then, how about migrations and cache clearing and stuff? It this automated too?
Yes. You may need to add a step to make your site maintenance mode.
But if it would takes long time, you may want to run migrations manually. If you want to rollback when something wrong happens, 1. update your app code to work with both before and after migrations. 2. deploy the app. 3. add migrations. 4. deploy the app (run migrations). |
Welcome Guest, Not a member yet? Register Sign In |