Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

What is the correct method of deploying vanilla to the cloud?

Greetings Vanilla Community. :)

Ok, I'll elaborate my situation a bit.
I'm trying to set up a test deployment of vanilla forum on a openshift cartridge. I build from the vanilla repo (cloned from github master) locally using phing and deploy the built package inside the './build' directory to openshift using 'git push'. Then openshift deployes the code from the repo. After that is done, I can access the web installation script of vanilla to configure my installation.

But, the problem is if I update something locally in the build package (in './build/package' directory), take for example add some extrnal plugins, themes etc. and push the changes back to openshift, then openshift ~~~~re-deployes vanilla and I'm forced to run the web installation script again. But, as the database is already existing on the server, the installation script creates duplicate entries. I also noticed that I lost my addon configurations.

So it makes me think that this is not the correct way of deploying vanilla forum on the cloud. I'm totally new to this cloud thing, btw. It will be great if someone can point me to the right method of deploying vanilla forum on the cloud so that I don't lose my configurations every time I make minor changes in my application locally and I don't have to run the installation script again and again after every git push to openshift.
Thank you.

Best Answers

  • LincLinc Admin
    Answer ✓

    Our automated deploy for a new site is more along the lines of:

    • Deploy the latest code.
    • Deploy a default, pre-made conf/config.php.
    • Run utility/update.

    This bypasses ever using the installer.

    If you are having issues where the installer is showing up on an already-installed forum, it indicates your deploy is possibly deleting the entire conf folder.

  • hgtonighthgtonight MVP
    Answer ✓

    @cinom said:
    Now, do I have to preserve the entire conf directory throughout deployments or is it only the conf/config.php file?

    config.php is the only file generated in that directory. You may have other files you want to put in there (locale.php, bootstrap.php, etc)

    And what is utility/update? Is it a script provided with vanilla? But, I don't see any directory called utility under application root. Maybe I'm getting it wrong?

    Vanilla uses a dispatcher to load the right controller and execute the right method. There is no directory called 'discussion', but here we are in https://vanillaforums.org/discussion/32121/what-is-the-correct-method-of-deploying-vanilla-to-the-cloud.

    The utility/update is calling the update method of the utility controller which is part of the dashboard application. You can see what is being executed in /applications/dashboard/controllers/class.utilitycontroller.php and looking for public function structure.

    If I want to move the conf directory out of the project root, how do I do that?
    Say for example, if my current directory structure is something like

    home
    │
    └───app-root
            │
            ├───vanilla-repo
            │        │      ...
            │        │      ....
            │        │      index.php
            │        │ 
            │        ├───conf
            │        │       │      ...
            │        │       │      config.php
            │        │       │ 
            │        │
            │
            └───data
    

    and I want it to become,

    home
    │
    └───app-root
            │
            ├───vanilla-repo
            │      │      ...
            │      │      ....
            │      │      index.php
            │      │
            │
            └───data
                    │      ... 
                    │      
                    └───conf
                            │      ... 
                            │      config.php
                            │ 
    

    how do I do that?
    Basically, is there any standardized way of doing this? I think I'll also have to change the location of the uploads directory to reside outside project root.

    You can change the PATH_CONF via a /conf/bootstrap.before.php file:

    <?php
    define('PATH_CONF', PATH_ROOT.'/conf'); // change to be whatever you want
    

    Now that you have changed where the /conf directory lies, you can change any of the other PATH constants via the /new_conf_dir/constants.php file, although you are most interested in PATH_UPLOADS.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Answers

  • Are you deploying the master branch? That is not suggested for production. I would use the release/2.2 branch.

    Either way, sounds like your /conf/config.php file is getting clobbered in the push. I have no idea how to troubleshoot this as I have no experience with openshift.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • LincLinc Admin
    Answer ✓

    Our automated deploy for a new site is more along the lines of:

    • Deploy the latest code.
    • Deploy a default, pre-made conf/config.php.
    • Run utility/update.

    This bypasses ever using the installer.

    If you are having issues where the installer is showing up on an already-installed forum, it indicates your deploy is possibly deleting the entire conf folder.

  • Thank you both for your replies. I'll try to implement the method Linc has shown.
    As I understand, openshift actually re-creates the entire deployment from scratch every time I push the local modifications to the repo. Nothing from the previous deployment is reused unless I keep it in the app-root/data directory; as can be seen here in the 'data' section. So yeah, every time I deploy my code through a git push, the entire content of the conf folder is getting recreated.
    Now, do I have to preserve the entire conf directory throughout deployments or is it only the conf/config.php file?

    And what is utility/update? Is it a script provided with vanilla? But, I don't see any directory called utility under application root. Maybe I'm getting it wrong?

    If I want to move the conf directory out of the project root, how do I do that?
    Say for example, if my current directory structure is something like

    home
    │
    └───app-root
            │
            ├───vanilla-repo
            │        │      ...
            │        │      ....
            │        │      index.php
            │        │ 
            │        ├───conf
            │        │       │      ...
            │        │       │      config.php
            │        │       │ 
            │        │
            │
            └───data
    

    and I want it to become,

    home
    │
    └───app-root
            │
            ├───vanilla-repo
            │      │      ...
            │      │      ....
            │      │      index.php
            │      │
            │
            └───data
                    │      ... 
                    │      
                    └───conf
                            │      ... 
                            │      config.php
                            │ 
    

    how do I do that?
    Basically, is there any standardized way of doing this? I think I'll also have to change the location of the uploads directory to reside outside project root.

  • hgtonighthgtonight MVP
    Answer ✓

    @cinom said:
    Now, do I have to preserve the entire conf directory throughout deployments or is it only the conf/config.php file?

    config.php is the only file generated in that directory. You may have other files you want to put in there (locale.php, bootstrap.php, etc)

    And what is utility/update? Is it a script provided with vanilla? But, I don't see any directory called utility under application root. Maybe I'm getting it wrong?

    Vanilla uses a dispatcher to load the right controller and execute the right method. There is no directory called 'discussion', but here we are in https://vanillaforums.org/discussion/32121/what-is-the-correct-method-of-deploying-vanilla-to-the-cloud.

    The utility/update is calling the update method of the utility controller which is part of the dashboard application. You can see what is being executed in /applications/dashboard/controllers/class.utilitycontroller.php and looking for public function structure.

    If I want to move the conf directory out of the project root, how do I do that?
    Say for example, if my current directory structure is something like

    home
    │
    └───app-root
            │
            ├───vanilla-repo
            │        │      ...
            │        │      ....
            │        │      index.php
            │        │ 
            │        ├───conf
            │        │       │      ...
            │        │       │      config.php
            │        │       │ 
            │        │
            │
            └───data
    

    and I want it to become,

    home
    │
    └───app-root
            │
            ├───vanilla-repo
            │      │      ...
            │      │      ....
            │      │      index.php
            │      │
            │
            └───data
                    │      ... 
                    │      
                    └───conf
                            │      ... 
                            │      config.php
                            │ 
    

    how do I do that?
    Basically, is there any standardized way of doing this? I think I'll also have to change the location of the uploads directory to reside outside project root.

    You can change the PATH_CONF via a /conf/bootstrap.before.php file:

    <?php
    define('PATH_CONF', PATH_ROOT.'/conf'); // change to be whatever you want
    

    Now that you have changed where the /conf directory lies, you can change any of the other PATH constants via the /new_conf_dir/constants.php file, although you are most interested in PATH_UPLOADS.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @hgtonight said:

    @cinom said:

    And what is utility/update? Is it a script provided with vanilla? But, I don't see any directory called utility under application root. Maybe I'm getting it wrong?

    Vanilla uses a dispatcher to load the right controller and execute the right method. There is no directory called 'discussion', but here we are in https://vanillaforums.org/discussion/32121/what-is-the-correct-method-of-deploying-vanilla-to-the-cloud.

    The utility/update is calling the update method of the utility controller which is part of the dashboard application. You can see what is being executed in /applications/dashboard/controllers/class.utilitycontroller.php and looking for public function structure.

    I see, it never occurred to me that Linc was actually talking about a url! That clarifies it. :o
    Anyways, thanks again @hgtonight. I'll try to update this thread later based on how the things work out for me. :3

Sign In or Register to comment.