Statically generated site for Redbrick https://www.redbrick.dcu.ie
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 5.9 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Static-Site
  2. [![CircleCI](https://circleci.com/gh/redbrick/static-site.svg?style=shield)](https://circleci.com/gh/redbrick/static-site)
  3. [![Code Climate](https://codeclimate.com/github/redbrick/static-site/badges/gpa.svg)](https://codeclimate.com/github/redbrick/static-site)
  4. [![Docker Build Status](https://img.shields.io/docker/build/jrottenberg/ffmpeg.svg)](https://hub.docker.com/r/redbrick/site/)
  5. [![](https://images.microbadger.com/badges/version/redbrick/site.svg)](https://microbadger.com/images/redbrick/site)
  6. [![](https://images.microbadger.com/badges/image/redbrick/site.svg)](https://microbadger.com/images/redbrick/site)
  7. A Static Site for [redbrick](http://redbrick.dcu.ie) generated with [hexo](https://hexo.io/) using a theme
  8. based off [icarus](https://github.com/redbrick/hexo-theme-icarus)
  9. ## Requirements
  10. 1. **Node** : v6.9(LTS) Download [Node](https://nodejs.org/download/)
  11. ## Development
  12. To set up the for development
  13. - `yarn` this will install all the dependencies
  14. - copy `.env.example` to `.env`
  15. - `yarn start` to create start the serve
  16. - To generate new posts
  17. - Run `yarn posts [title]` This will create a new post in `source/_post/[title].md`
  18. - To generate new pages:
  19. - Run `yarn page [title]` this will create a new page in `source/[title]/index.md`
  20. - To edit the sidebar:
  21. - Edit `themes/redbrick-theme/_config.yaml` - this is where all the theme configuration is controlled from.
  22. ### Docker
  23. Theres a `docker-compose.yml` for development.
  24. - Copy `.env.example` to `.env`
  25. - Run `docker-compose up`
  26. ### Generate
  27. - To demo the site run `yarn start`. This will create a server that runs on `localhost:3000`
  28. - To work on css and have it auto regenerate use `yarn hexo`. This will create a server that runs on `localhost:4000`
  29. ### CSS and Templates
  30. - You can edit the css for the theme in `themes/redbrick-theme/source/css`
  31. - You can edit the templates in `themes/redbrick-theme/layout`
  32. ### Google analytics
  33. Analytics can be enabled by adding your analytics key to `theme/redbrick/_config.yaml`
  34. ## Production
  35. ### Setup
  36. To deploy to a server run:
  37. - `yarn` this will install all the dependencies
  38. - modify `_config.yml` as needed
  39. - copy `production/website.service` to `/etc/systemd/system`
  40. - `yarn generate` to create initial site
  41. - `systemctl start website` to start the express server
  42. You will also need to create three files:
  43. - `mailing_list` a newline-separated list of email addresses
  44. - `email_update_log` a newline-separated reverse-chronological list of times email updates were sent
  45. - `.env` by copying `.env.example` and **modifying values (*important*)**
  46. - Set any Environment Variables through the env file
  47. `mailing_list` and `email_update_log` can be left blank, though updates for every post in history
  48. will be sent if no previous send date is specified.
  49. Then using apache or nginx proxy traffic to port 3000.
  50. And done.
  51. ### Docker
  52. To use docker in production theres a `docker-compose.yml` in the production folder.
  53. - Copy the `.env.example` to `.env` relative to the `docker-compose.yml`.
  54. - Modify `.env`
  55. - Create a file called `mailing_list` and add email addresses for announce
  56. - run `docker-compose up -d`
  57. ### Generate via API
  58. - While the server is live, a visit to `http://[sitehost]/api/regenerate?token=your_secret_token`
  59. will run `hexo generate` and send emails for any new posts so long as that process is not already underway.
  60. ### Mail Options
  61. To use sendmail rather then SMTP in the `_config.yml` set `useSendMail` to `true`.
  62. To disable auth on SMTP leave `auth.user` and `auth.pass` as empty.
  63. Modify the host, and port options as needed for SMTP either in the config or using the env
  64. variables.
  65. ## Environment Variables
  66. | Variable | Example | Description |
  67. | :--- | :---: | ---: |
  68. | `SECRET_API_TOKEN` | | API key for regenerating the site |
  69. | `RECAPTCHA_SECRET_KEY` | | Recaptcha server key from Google |
  70. | `RECAPTCHA_SITE_KEY` | | Recaptcha site key same as the on in the theme |
  71. | `LOG_ROTATE` | `24h` | When to rotate logs |
  72. | `SMTP_HOST` | `mailhost.redbrick.dcu.ie` | SMTP host address |
  73. | `SMTP_PORT` | `25` | SMTP port for server |
  74. | `SMTP_SECURE` | `false` | if using SSL or not |
  75. | `SMTP_USER` | `no-reply` | redbrick username for SMTP auth leave off the `@redbrick.dcu.ie` |
  76. | `SMTP_PASS` | | account password |
  77. | `SMTP_AUTH_METHOD` | `plain` | auth method to use with SMTP. Defaults to plain |
  78. | `PORT` | `3000` | port to run the server on defaults to 3000 |
  79. ## License
  80. Official website of DCU Redbrick Society.
  81. Copyright (C) 2017 Redbrick and all contributors.
  82. This program is free software: you can redistribute it and/or modify it under
  83. the terms of the GNU General Public License as published by the Free Software
  84. Foundation, either version 3 of the License, or (at your option) any later
  85. version.
  86. This program is distributed in the hope that it will be useful, but WITHOUT ANY
  87. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  88. PARTICULAR PURPOSE. See the GNU General Public License for more details.
  89. You should have received a copy of the GNU General Public License along with
  90. this program. If not, see <https://www.gnu.org/licenses/>.