Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Log website URL upon deployment #947

Closed
wants to merge 5 commits into from

Conversation

yash-chowdhary
Copy link
Contributor

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [x] Other, please explain: Involves a logging change

Fixes #844

What is the rationale for this request?
This change helps the user easily access the website after deploying it using the MarkBind CLI.

What changes did you make? (Give an overview)
In order to get the URL of the deployed website, the details of the repository are required. Should the remote URL of the repository not be present in the deploy section of site.json, an external library (NodeGit) will fetch it. The website URL (deployment URL) is constructed using this remote URL.

Provide some example code that this change will affect:

function getUrl() {
  return new Promise((resolve) => {
    Git.Repository.open('.git').then(((repo) => {
      repo.config().then(((config) => {
        config.getStringBuf(REMOTE_ORIGIN_URL_KEY)
          .then(((buf) => {
            resolve(buf.toString());
          }));
      }));
    }));
  });
}

Proposed commit message: (wrap lines at 72 characters)
Log website URL upon MarkBind deployment

Copy link
Member

@yamgent yamgent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your PR.

Our Netlify builds are failing because this PR introduced a new package nodegit. The log of the failed build shows that it had problems getting some dependencies:

10:41:18 AM: error: uncaughtException: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/build/repo/node_modules/nodegit/build/Release/nodegit.node) date=Sun Dec 08 2019 02:41:18 GMT+0000 (UTC), pid=1357, uid=2500, gid=65534, cwd=/opt/build/repo/docs, execPath=/opt/buildhome/.nvm/versions/node/v8.16.2/bin/node, version=v8.16.2, argv=[/opt/buildhome/.nvm/versions/node/v8.16.2/bin/node, /opt/build/repo/index.js, build, --baseUrl], rss=61157376, heapTotal=39768064, heapUsed=22207456, external=98720, loadavg=[4.89599609375, 4.5615234375, 4.478515625], uptime=9613
10:41:18 AM: Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/build/repo/node_modules/nodegit/build/Release/nodegit.node)

I was able to fix this issue by using a newer version of the build image by Netlify. Therefore, it is likely that old sites will face this issue.

Perhaps you can modify docs/userGuide/tipsAndTricks.md to add this:


Problem: Netlify fails to build website, as it complains that error: uncaughtException: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.20 not found.

Your Netlify build setup might be using an outdated version of Ubuntu. You should go to: Deploy Settings -> Build & deploy, under "Build image selection", ensure that the build image is at least "Ubuntu Xenial 16.04".


If there are alternative packages/methods that allow us to avoid this problem completely, that would be the best, otherwise adding the above should be sufficient.

Some other preliminary comments:

src/Site.js Outdated
*/
function getUrl() {
return new Promise((resolve) => {
Git.Repository.open('.git').then(((repo) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deployment may not always be called at the root directory, so .git may not always exist. We can change .git -> ./.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change .git -> ./.

Addressed

Perhaps you can modify docs/userGuide/tipsAndTricks.md

Addressed

If there are alternative packages/methods that allow us to avoid this problem completely, that would be the best, otherwise adding the above should be sufficient.

There was another package that did the job - git-remote-origin-url, but it messed around with the gitconfig file which consequently failed several tests. That's why I went ahead with nodegit.

deploymentUrl = `https://${parts[parts.length - 2]}.${GITHUB_IO_STRING}/`
+ `${parts[parts.length - 1].substring(0, parts[parts.length - 1].length - 4)}`;
}
return deploymentUrl;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub allows custom domain through the use of CNAME. Check it out here.

Therefore, this method would generate the wrong URL if the user is using a custom domain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Currently looking into programmatically getting the CNAME that points to the default GitHub pages domain. ✌️

@yash-chowdhary yash-chowdhary changed the title Log website URL upon deployment [WIP] Log website URL upon deployment Dec 8, 2019
@yash-chowdhary
Copy link
Contributor Author

For anyone looking to take up this issue, the only thing remaining to be done is to programmatically get the CNAME that points to the default GitHub pages domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log website url on MarkBind deploy
2 participants