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

Set up Docker deployment and Express Server #990

Merged
merged 52 commits into from
Jan 3, 2019
Merged

Conversation

EvanLovely
Copy link
Contributor

@EvanLovely EvanLovely commented Dec 14, 2018

Jira

  • BDS-693
  • BDS-586

Summary

Replacing static site hosting with an Express server and a Docker deployment and wiring up the Bolt API!

Details

Travis CI builds a Docker image that runs the install, build, and test and then pushes it up to Docker Hub, then our deploy script goes into the ./deploys/ folder to run the now.sh deploy that pulls that Docker image down to run and serve. This is done to get around issues that now's deploy script has with upload all the correct files due to it's incorrect parsing of ignore files. Additionally, all build dependencies like php, node, and yarn version are pre-built into the bolt-docker image (details on Docker Hub and the GitHub repo).

Additionally, the route that was available at /api when running the local server is now hooked up to the hosted site! It's using the same routing so all should be available locally and on the deployed server.

I've also added the now.sh unique deploy urls as a commit status check to each commit so you can view the unique url each commit generated.

How to test

All of this relates to CI work so checking Travis logs and its deployed site should be enough. However, one could build and run the Docker container using these commands:

bash ./scripts/docker-build.sh
bash ./scripts/docker-run.sh

To test the api, send a GET request to /api and you'll get back a simple response saying you've hit the Bolt API. The only other route that was being used locally, /api/render-twig is also available, but ensuring that it works on server as it does with a local server is outside the scope of this PR.

Remaining Work

  • Ensure redirects are in place:

https://github.com/bolt-design-system/bolt/blob/aebfb651e250e0fab1610662622b3b56b773ad33/Xnow.old.json#L8-L37

  • Ensure that old deploys are not using the accounts finite amount of minimum scaling. I have the minimum set to 1 so the site loads quick. I could see setting old deploys that aren't the latest on a branch to a minimum scale of 0 so you could still access them but they didn't take up one of the "Instances" you have (pretty sure you're on Pro plan with 25 available instances). Also, it's possible to clean up old deploys with:
now rm boltdesignsystem --safe --yes # --safe skips removing ones with active alias
  • Speed up CI. This looks like it's adding more time than I'd like.

  • Consider how to handle NPM deps used in Deploy and Nightwatch scripts. I'm skipping the yarn install in the Travis build as the Docker build does that, so when our scripts that deploy and kick off Nightwatch testing start, they don't have. Currently I've set up the ./scripts folders own package.json as a workaround:

https://github.com/bolt-design-system/bolt/blob/7d983c69d98caf2d3fc0623ce22bc8f18a598ebf/.travis.yml#L37-L40

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

bolt-bot commented Jan 1, 2019

⚡ PR built on Travis and deployed a now preview here:

@sghoweri
Copy link
Contributor

sghoweri commented Jan 1, 2019

@EvanLovely
Copy link
Contributor Author

🎉 Awesome!! Happy New Year!

@bolt-bot
Copy link
Collaborator

bolt-bot commented Jan 2, 2019

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

bolt-bot commented Jan 2, 2019

⚡ PR built on Travis and deployed a now preview here:

@sghoweri
Copy link
Contributor

sghoweri commented Jan 3, 2019

This should hopefully be good to merge in later today after a few small changes I’ll be wrapping up this morning:

  1. Revert a few of the changes added in
    35fb047 — specifically the component schema changes made to the button and navbar components (other than then $ref update to wire up icons to the button) and revert adding Redux to this PR
  2. Put in a Twig fix to remove the Drupal Attributes object from schemas being processed
  3. Put in a new PR wiring up Redux to our base web component Class
  4. Nix the old Button component interactive demo
  5. Separately add a few new tickets for the follow-up work with this: wiring up our remaining components to use the new Component Explorer, re-enabling local storage support to Redux, re-enabling the iframe resize functionality, etc!

@bolt-bot
Copy link
Collaborator

bolt-bot commented Jan 3, 2019

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

bolt-bot commented Jan 3, 2019

⚡ PR built on Travis and deployed a now preview here:

@bolt-bot
Copy link
Collaborator

bolt-bot commented Jan 3, 2019

⚡ PR built on Travis and deployed a now preview here:

@sghoweri sghoweri merged commit 4814504 into master Jan 3, 2019
@sghoweri sghoweri deleted the feature/server branch January 3, 2019 17:46
@sghoweri sghoweri mentioned this pull request Jan 8, 2019
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.

4 participants