Custom domain on Openshift Nodejs App doesnt show up. [+process.env.OPENSHIFT_APP_DNS] - node.js

I run a ghost blog on openshift, i created with success custom domains for my site and everything works nice, but the subscribe link as some other links in my menu points to my openshift url ghost-nodejs.rhcloud.com than to my custom domain my-blog.com.
After i cloned the git repo on my machine, i opened the config.js and changed the url: 'http://my-ghost-blog.com', to my custom domain url: 'http://my-blog.com', but nothing changes. I also later changed production: {
'url: 'http://'+process.env.OPENSHIFT_APP_DNS, to my custom domain but that change made my blog not work at all. ( I completely remove the +process.env.OPENSHIFT_APP_DNS part)
Can someone guide me on this?
PS: The git commands i use are git clone ssh//***** i alter some stuff locally and then i run
git add -A then git commit -a -m 'alter my app' and finally git push

Make sure you run the following to set your runtime to production
`rhc set-env NODE_ENV=production --app yourappname'
This will make sure that the changes you made under the production section of your config.js are used.

Related

create(clone) the same app for development in heroku

I am having the app http://example.com in heroku. So I need to create(clone) the same app for my development in subfolder http://example.com/subfolder. How to do this. Any help will be much appreciated.
Note:
I am having only heroku access, no domain login available with me.
Heroku nodejs application.
I am new to Heroku. I have clonned the same app in my localhost:5000. But needed online development environment.
Finally I created the staging environment. My development environment is in local.
Once I clone my production app to my local, then I am creating the staging environment.
ref this link for downloading code from heroku. Ensure that you have downloaded the application slugs.
Once cloned into my local. I checked with localhost:5000. For this I have already installed node server and git in my windows 10.
heroku create --remote staging
after the above command, you will see the new staging environment(name will be auto generated) created in your Heroku login.
Click on that newly created app name in heroku login and then deploy tab, follow the procedure given in that. for which the link can be like this https://dashboard.heroku.com/apps/autogenerated-appname-12345/deploy/heroku-git
And in the final step git push heroku master I got the error
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Then I used git push staging master which is mentioned in this document.
Then I checked in the browser https://autogenerated-appname-12345.herokuapp.com/

custom_hooks not working on gitlab/docker

I use a docker image of gitlab, https://hub.docker.com/r/sameersbn/gitlab/ on a synology nas to manage our pipeline dev.
I plan to deploy any push in the master branch to a production folder, where all our software looks to load scripts/ plugins.
To deploy to the production server, on the same server but outside the docker image.
the production folder is set as a clone of the server
git clone /gitserver/path /prod/folder/path
all works as planned
then, I've tryied to use a custom_hook for a repo as described on the documentation here : https://docs.gitlab.com/ee/administration/custom_hooks.html
the custom hooks is called "post-update", chmod +x and rights allowed to anyone (for testing). here is the content of the hook
#!/bin/bash
echo "********** publishing to prod *********"
cd /prod/folder/path
unset GIT_DIR
git pull origin master
echo "********** Publish to prod complete *********"
when I push to the git server, nothing happened.
If I run manually the post-update script, all work as espected so it seems that the problem come from gitlab custom_hooks support.
I have seen many posts about problems with custom hooks but none of them helps me
https://gitlab.com/gitlab-org/gitlab-ce/issues/1742
https://gitlab.com/gitlab-org/gitlab-ce/issues/38193
Gitlab custom hook not running
how can I make custom_hooks works ?

Why is my app still displaying old code after generating new app?

I deployed my app like a month ago, and everything was working OK.
In the meantime my app changed a lot so I decided to deploy new version.
I used command git push heroku deployment:master (git branch deployment is containing some files just for deployment).
When I opened my app via heroku open I noticed that my app is still using old home page. After Googling around I've tried:
heroku reset
Creating new branch and pushing new code with few test lines added
Try to clear cache, open pages in different browsers
Checking the files with heroku run bash (all files are as they should be)
I went even further and tried:
heroku apps:destroy
heroku create (created new project, and used git push heroku deployment:master again)
Event after accessing the new URL, there is still old code, old .html pages and everything. I'm using Node.js v8.11.4
Help me out please! Thanks in addition.
EDIT: Was trying also to git clone Heroku Git URL, to my desktop. All files are as expected, I have no idea, where is heroku getting old files...
After 2 days of fooling around and trying a lot of different things there were 2 things that I need to do.
Don't forget to run ng build before deploying new version of app, or else old public files will be deployed
Clear the build cache for an app using the following commands:
heroku plugins:install heroku-repo
heroku repo:purge_cache -a appname
git commit --allow-empty -m "Purge cache"
git push heroku master
Where appname is replaced by the name of the app you want to clear the cache for.
SOURCE: How to clear build cache

Ghost(node.js) app - 503 err after git push in OpenShift hosting

I created ghost blog in OpenShift host. Everything worked fine.
I wanted to make some changes in css file(change the margin of the page title), so i did git pull the resources, made changes in css file locally, and git push back with command git push -f(force) openshift master, because without -f, I couldn't do this push.
After this "git push" command, my app got broke, and now, the http outputs 503 error...
I tried to restart my app, but it doesn't help. Don't know why it crashed.
Not sure what actually happened with your new change.Check the app logs.
First ssh to your app
ssh 1234567890abcdef1234567890abcdef#your-app-domain.rhcloud.com
and then cd to logs directory
cd app-root/logs
tail the contents of nodejs.log file
This may not actually resolve your issue but logs can help you.

Development build of my Node.js site

I have a production build of my site on a VPS, and I deploy to a bare git repo which has a hook that checkouts the commits to an app directory. I use forever to keep my app running from the app directory.
What I want to do is set up a development build which I can push to. The development build could be hosted under a subdomain on my VPS. However, I'll need an authentication step that'll prevent anyone and everyone from accessing the development site. How could I put authentication in front of an entire site with little (if any) changes to my application?
Why don't you just run it on a port that isn't available to the public and then you could create an ssh tunnel and access it via localhost?
Add a dev ssh user to your VPS and assign it a password.
Your ssh tunnel would look like this (just adjust your ports accordingly):
ssh -N -L8808:localhost:8808 user#destination.com
You'll be prompted for your password and then you would leave your terminal session open and go to your dev server via "http://localhost:8808"
Another option (something I typically do). Is to have a file checked into your repo named "config.sample.json" with configuration information (in this case your username/password [development] restriction). Then you also set up git to ignore "config.json" (so you don't accidentally commit this to your repository and have to edit files on your production deployments).
Next you would write a function that would require that config.json file and use it's configuration data if the file is found otherwise it would load up as "production".
Then you would deploy your code to your development directory and afterward rename your "config.sample.json" to "config.json" and make any edits that were needed in that file to setup debugging, access control, etc.

Resources