How to deploy a custom build on production?

I made some changes in core (both server and client) to support ldap authentication and then created prod build by running grunt prod. I also already have a prod instance running which was deployed earlier using ghost-cli by runing ghost install.

How do i deploy my custom build over the current running prod build? Can i simply put them in a new folder under versions and update the current folder’s symlink? Will that work?

3 Likes

Offtopic, but if you could share your LDAP auth implementation it would be wonderful!

You can zip your build and run ghost update --zip /path/to/zip

yes, they are here.

It is not clean though. Lots of patching and duct tape job to make it work (not a js dev here). Active directory details goes in config (config.development.js).

"ad": { 
   "url": "ldap://dc.domain.com",
   "baseDN": "dc=domain,dc=com",
   "username: "username@domain.com",
   "password": "password"
 }

The auth happens in oauth.js. Basically, i take email id and query AD for the email field, if found then validate its sAMAccountName with given password. This part is easy, but new user registration on blog is not straightforward.

New users on blog, on first time login using their AD credential, if AD validates, then they would receive invitation on their mail. They need to complete registration using this invitation in order to use the blog. This step basically creates that user in blog db.

You can diff with master branch and check what files are changed. Do note that this is meant to be run in local environment (LAN) only as few security restrictions are relaxed, like the new user invitation goes out without a need for authentication. Getting the default role id for new user invitation without authentication. etc. Default role for all new users in contributor, so that they cannot publish post as soon as they get access.

ghost update --zip /path/to/zip - didn’t work for me. Getting version mismatch error.

Could you paste the error? Looking at your branch, I think it might be because it’s not semver compliant

You are right. The version no was not proper in my case.
But even after fixing that ghost update doesn’t update with my zip file. It checks for the latest version and then says, All up to date !. I will try to deploy manually now.

That suggests your current version is greater than the zip version (i.e. you’re on Ghost 2.0.0 and the release is Ghost 2.0.0-rc.1). You need to make sure it’s a newer version. Use ghost update --rollback to rollback to an older version if needed, or just update the version of the new zip.

1 Like

Thanks. Rollback to 1.25.5 and then update with zip worked.

Note: zip created by grunt release

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.