CodeIgniter Forums
Shared Hosting to VPS - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Shared Hosting to VPS (/showthread.php?tid=90928)

Pages: 1 2


Shared Hosting to VPS - HarmW94 - 05-23-2024

Hey,

I'm quite new to using CodeIgniter (PHP frameworks in general) but so far I like it better than any other framework. In addition, the project is already becoming quite complex and that is great.

Now this application runs on Shared Hosting, but I also have a VPS that is not being used (6 Cores, 16GB RAM and 500GB Data) with a PLESK license. This is where I actually want to move my CodeIgniter project.

My question is actually how I can start working with version control. I've done some searching here and there, but I'm not really any wiser. I want to be able to continue working on the application in development mode without other users being bothered.

In addition, it is easy with cronjobs and SSH.

Is there anyone who is willing/able to provide a brief explanation of this or who can enlighten me?

Thank you in advance and it is much appreciated.


RE: Shared Hosting to VPS - captain-sensible - 05-23-2024

i run apache web server on Arch linux for my CodeIgniter projects . I just use git ,via command line in location context of being web root of codeIgniter wweb site. I use shared hosting . I have capacity for a few web sites . I get a domain from ionos, and use add on domain , manage domain . Fo all intents and purposes you wouldnt know cicking on domain that its via a add on domain.

For a new website to load up from dev, i use rsync along the lines of ;
Code:
from terminal CD to document route of web
prompt$ cd /srv/http/myweb
(inside http  i have CI4 dev directory called say "myweb" )


prompt$ git commit -a -m "ready for live"
prompt git tag -a v5.5 -m " "
prompt$    cd ../
(back to /srv/http)
rsync -avu      --exclude  .git --exclude node_modules   myweb/         /home/andrew/Desktop/arbitaryDirName/



So i use rsync to start taking things out i dont want to upload.Then there (the way i do it) are only 4 directories i need , which i zip and upload to server. Thats app, public, vendor ,writable and .env
So i do use version control , but i like to do manually. Once i have web up and working, i just over write single files, i know changed


RE: Shared Hosting to VPS - HarmW94 - 05-23-2024

Thanks for you reply @captain-sensible.

I don't really want to have anything running locally. I have read a little more about GitHub/Version Control and some things seem to be possible. I want to make it as easy as possible for myself without having to drag around files.

In the sense of:
dev.domain* = development
domain* = production

Or something similar.

I hope someone has more experience with this and in the meantime I will delve deeper into it.


RE: Shared Hosting to VPS - kenjis - 05-23-2024

Git is a very complicated tool. It is not easy to learn.
You would need much time to learn it.

Introduction to version control with Git
https://learn.microsoft.com/en-us/training/paths/intro-to-vc-git/


RE: Shared Hosting to VPS - HarmW94 - 05-24-2024

Thanks @kenjis.

But can't do what I want or is there even a better solution? Or do you have maybe a better idea?
For me its very important that I can work on the application in dev mode while other users are on the production side.

I was thinking for another solution since Im the only developer right now; I make three folders
- side1
- side2
- backup (holds the latest stable version)

dev.domain* goes to side1
domain* goes to side2

When im done with whatever I can switch the sides (inside Plesk for example) and change te .env file to dev or prod.
The only thing is then that I've to copy constantly the updated version to the former "side".

Or is that a little bit overthinking? The idea sounds great but it isn't effective imo


RE: Shared Hosting to VPS - kenjis - 05-24-2024

First of all, I recommend you learn git. Because git is a basic tool for collaboration in modern development.
For example, if you don't know git, you cannot contribute to CodeIgniter at all even if you are a super hacker.
Using git is really worth.


RE: Shared Hosting to VPS - HarmW94 - 05-25-2024

(05-24-2024, 07:57 PM)kenjis Wrote: First of all, I recommend you learn git. Because git is a basic tool for collaboration in modern development.
For example, if you don't know git, you cannot contribute to CodeIgniter at all even if you are a super hacker.
Using git is really worth.

Thanks I'll do that!

I've a major problem. When I set the environment to "development" I got the following error:

Code:
CodeIgniter\Database\Exceptions\DatabaseException #1146
Table 'dwerggeiten.settings' doesn't exist

When I put it back to "production" then the error goes away and everything works...

Any ideas?


RE: Shared Hosting to VPS - JustJohnQ - 05-25-2024

Are you using a different database when in development?


RE: Shared Hosting to VPS - HarmW94 - 05-25-2024

(05-25-2024, 10:33 PM)JustJohnQ Wrote: Are you using a different database when in development?

No, not at all.


RE: Shared Hosting to VPS - HarmW94 - 05-29-2024

Very strange. Didn't fit it out yet..

My .env file:

Code:
CI_ENVIRONMENT = production

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

app.baseURL = ''
app.forceGlobalSecureRequests = true
# app.CSPEnabled = false

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

# database.default.hostname =
# database.default.database =
# database.default.username =
# database.default.pa sssword =
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306

# database.tests.hostname = localhost
# database.tests.database = ci4_test
# database.tests.username = root
# database.tests.password = root
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306

The database.php;
Code:
/**
     * The default database connection.
     */
    public array $default = [
        'DSN'          => '',
        'hostname'     => 'localhost',
        'username'     => '//',
        'password'     => '//',
        'database'     => '//',
        'DBDriver'     => 'MySQLi',
        'DBPrefix'     => '',
        'pConnect'     => false,
        'DBDebug'      => true,
        'charset'      => 'utf8mb4',
        'DBCollat'     => 'utf8mb4_unicode_ci',
        'swapPre'      => '',
        'encrypt'      => false,
        'compress'     => false,
        'strictOn'     => true,
        'failover'     => [],
        'port'         => 3306,
        'numberNative' => false,
    ];

(Deleted sensitive data)