Browse Source

Update README, and NginX configuration accordingly

keep-around/c6c62d3cdd7fcd08c28c5ef9e04c62beda6e83c6
hellekin 5 years ago
parent
commit
eccb028130
3 changed files with 86 additions and 54 deletions
  1. +56
    -32
      README.md
  2. +18
    -14
      etc/nginx-development.conf
  3. +12
    -8
      etc/nginx-production.conf

+ 56
- 32
README.md View File

@@ -2,6 +2,10 @@

This is the source code for [beta.devuan.org][beta].

**Version note**: although this file mentions v0.9.0, it's not tagged
yet. It will be tagged 0.9.0 when released (on the master branch), and
should reach 1.0 by Jessie.

__Version 0.9.0__. We're using [Semantic Versioning](https://semver.org/).

## License
@@ -10,7 +14,7 @@ The source code is free software distributed under the GNU Affero General
Public License, version 3, or, at your option, any later version. (See
[COPYING](./COPYING).)

The website contents are creative commons released under
The website contents are creative commons released under
CC-BY-ND-4.0-International.

## Contents
@@ -25,7 +29,7 @@ This is a static Web made with [Middleman](https://middlemanapp.com/).
| | nginx-development.conf | To run the site locally |
| | nginx-production.conf | To deploy publicly |
| locales/ | :lang.yml | Localized strings |
| source/ | | Web contents |
| source/ | | Web content |
| source/layouts | *.erb | Layout templates |
| source/pages | *.:lang.html.md.erb | Localized pages |
| source/partials | | Partial files (includes) |
@@ -44,38 +48,42 @@ To deploy the site locally:

### 0. Pre-requisites

You need Ruby (and `ruby-dev`) and a couple of ruby packages (`gems`):
You need Ruby (`sudo apt install ruby-dev`).
The development files are useful to compile some `gems`.
Then you need a couple of ruby packages (`gems`):

```
~$ sudo gem install middleman bundler
```

They will take care of their dependencies.
Lucas Nussbaum and the Debian Ruby team made a fantastic job integrating
Ruby in Debian--hence in Devuan.

### 1. Clone the source code

```
~$ mkdir -p ~/src/devuan/www && cd $_
www$ git clone https://git.devuan.org/devuan-editors/devuan-www.git beta.devuan.org
www$ cd beta.devuan.org
beta.devuan.org$ export DIR=$PWD
www$ git clone https://git.devuan.org/devuan-editors/devuan-www.git devuan.org
www$ cd devuan.org
devuan.org$ export DIR=$PWD
```

The source code now lives at `~/src/devuan/www/beta.devuan.org`.
The source code now lives at `~/src/devuan/www/devuan.org`.
We keep track of this path using the variable `DIR`.

### 2. Install the server configuration

```
1 beta.devuan.org$ echo '127.0.0.1 beta.devuan.org' | sudo tee -a /etc/hosts
2 beta.devuan.org$ cd /etc/nginx/sites-available
3 sites-available$ sudo ln -s $DIR/etc/nginx-development.conf beta.devuan.org
1 devuan.org$ echo '127.0.0.1 devuan.invalid' | sudo tee -a /etc/hosts
2 devuan.org$ cd /etc/nginx/sites-available
3 sites-available$ sudo ln -s $DIR/etc/nginx-development.conf devuan.invalid
4 sites-available$ cd ../sites-enabled
5 sites-enabled$ sudo ln -s ../sites-available/beta.devuan.org
5 sites-enabled$ sudo ln -s ../sites-available/devuan.invalid
6 sites-enabled$ sudo /etc/init.d/nginx reload
```

1. Add a fake host to be able to use the domain
Warning: you may want to use a different fake domain, e.g.,
`devuan.invalid` instead to avoid conflict with actual URLs.
2. to the end: enable nginx configuration

@@ -83,20 +91,20 @@ We keep track of this path using the variable `DIR`.

```
sites-enabled$ cd $DIR
beta.devuan.org$ bundle exec middleman build
devuan.org$ bundle exec middleman build
```
This generates the static files in `$DIR/webroot`.
This generates the static files in `$DIR/public`.

### 4. Browse it

You can fallback to the backend for non-built files if you run the local
middleman server:
middleman server (and edit the NginX configuration):

```
beta.devuan.org$ bundle exec middleman server -p 4569
devuan.org$ bundle exec middleman server -p 4569
```

Open your browser to `http://beta.devuan.org` (or `beta.devuan`, YMMV)
Open your browser to `http://devuan.invalid`

## Production Deployment

@@ -105,37 +113,54 @@ The main site (`beta.devuan.org`) is in English by default.
### Mirrors

Mirrors should change the default language to set theirs in `config.rb`.
Do commit the change, so that it will be kept during updates, but DO NOT PUSH
it! If you need to push, you should use another working directory than the
deployed one.
Do commit the change, so that it will be kept during updates.
If you want to push the change, use a branch, e.g., `fr.devuan.org`:

Once your mirror is deployed, please send its URL, language, location, and
person responsible to [the relevant topic on Devuan Discourse][mirror], so it
can be added to the list. E.g., a mirror in France can be accessed via
```
devuan.org$ git checkout -b fr.devuan.org
```

Once your mirror is deployed, please send its URL, language, location,
and person responsible to [the mirror issue][mirror], so it can be added
to the list. E.g., a mirror in France can be accessed via
fr.devuan.org.

You're welcome to announce your mirror in the [Mirroring Devuan][t45]
discussion space.

[beta]: https://beta.devuan.org/
[mirror]: https://talk.devuan.org/t/mirroring-devuan/45
[mirror]: https://git.devuan.org/devuan-editors/devuan-www/issues/1
[t45]: https://talk.devuan.org/t/mirroring-devuan/45

# Content Production

## Creating Pages

- pages go to `source/pages/os`
- name the file: `source/pages/os/your-slug-title.en.html.md.erb` where `en` stand for English. Adjust locale to the ISO two-letter code for language.
Example: `source/pages/os/documentation/howto-create-new-pages.en.html.md.erb`
- name the file: `source/pages/os/your-slug-title.en.html.md.erb` where
`en` stands for English. Adjust locale to the ISO two-letter code for
language. Example:
`source/pages/os/documentation/howto-create-new-pages.en.html.md.erb`
The weird extension chain ensures that `middleman` will go through Embedded ruby (erb), Markdown (md), HTML, and the translation engine (en). The final extension will be `.en.html`. You can edit in Markdown, HTML5, and Embedded Ruby (erb). Normally Markdown will suffice.
The weird extension chain ensures that `middleman` will go through
Embedded ruby (erb), Markdown (md), HTML, and the translation engine
(en). The final extension will be `.en.html`. You can edit in
Markdown, HTML5, and Embedded Ruby (erb). Normally Markdown will
suffice.
Running `bundle exec middleman build` will generate the static HTML in `public/os/documentation/howto-create-new-pages.html`. Note that the primary language does not appear in the path. If you're building a page in another language, say French, it will appear in `public/os/documentation/howto-create-new-pages.fr.html`.
Running `bundle exec middleman build` will generate the static HTML in
`public/os/documentation/howto-create-new-pages.html`. Note that the
primary language does not appear in the path. If you're building a
page in another language, say French, it will appear in
`public/os/documentation/howto-create-new-pages.fr.html`.
### Front matter
### Front matter
We use the _YAML front matter_ to set variables such as the page title,
or its sibling pages. Please refer to existing pages for examples.
Here is a list of common variables:
| Variable | Value | Where? |
| Variable | Value | Where? |
|:---------|:-------------------------------------------|:----------------------|
| title | Some Descriptive Title | All pages |
| topic_id | number matching a topic in talk.devuan.org | pages with discussion |
@@ -149,4 +174,3 @@ Please refer to [Middleman documentation](http://middlemanapp.com/doc).
## Editing Pages

Thank you for contributing!


+ 18
- 14
etc/nginx-development.conf View File

@@ -1,22 +1,22 @@
#
# beta.devuan.org
# devuan.org
#
# Development version
#
# Add a fake domain for development:
# echo '127.0.0.1 beta.devuan.org' | sudo tee -a /etc/hosts
# echo '127.0.0.1 devuan.invalid' | sudo tee -a /etc/hosts
# Run middleman locally:
# gem install middleman
# middleman server -p 4569
#
upstream beta {
upstream devuan_org {
server 127.0.0.1:4569;
}

server {
listen 127.0.0.1:80;
server_name beta.devuan.org;
root /srv/www/beta.devuan.org/public;
server_name devuan.invalid;
root /srv/www/devuan.invalid/public;
index index.html;

# Old URLs
@@ -48,13 +48,17 @@ server {
set $gdo https://git.devuan.org;
set $tdo https://talk.devuan.org;

rewrite ^/my/activity $tdo/my/activity redirect;
rewrite ^/my/bookmarks $tdo/my/activity/bookmarks redirect;
rewrite ^/my/dashboard $gdo/dashboard redirect;
rewrite ^/my/messages $tdo/my/messages redirect;
rewrite ^/my/milestones $gdo/dashboard/milestones redirect;
rewrite ^/my/preferences $tdo/my/preferences redirect;
rewrite ^/my/todo.* $gdo/dashboard/todos?action_id=&author_id=&project_id=&state=pending&type= redirect;
rewrite ^/my/dashboard $gdo/dashboard redirect;
rewrite ^/my/milestones $gdo/dashboard/milestones redirect;
rewrite ^/my/todo.* $gdo/dashboard/todos?state=pending redirect;

rewrite ^/my/activity $tdo/my/activity redirect;
rewrite ^/my/bookmarks $tdo/my/activity/bookmarks redirect;
rewrite ^/my/messages $tdo/my/messages redirect;
rewrite ^/my/preferences $tdo/my/preferences redirect;
rewrite ^/my/profile $tdo/my/profile redirect;

return 403;
}


@@ -84,10 +88,10 @@ server {
# rewrite ^/fr/(.*)$ /$1 last; # French mirror example

location @backend {
return 404;
return 404; # Comment this if you want to run middleman locally
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_intercept_errors off;
proxy_pass http://beta;
proxy_pass http://devuan_org;
}
}

+ 12
- 8
etc/nginx-production.conf View File

@@ -46,13 +46,17 @@ server {
set $gdo https://git.devuan.org;
set $tdo https://talk.devuan.org;

rewrite ^/my/activity $tdo/my/activity redirect;
rewrite ^/my/bookmarks $tdo/my/activity/bookmarks redirect;
rewrite ^/my/dashboard $gdo/dashboard redirect;
rewrite ^/my/messages $tdo/my/messages redirect;
rewrite ^/my/milestones $gdo/dashboard/milestones redirect;
rewrite ^/my/preferences $tdo/my/preferences redirect;
rewrite ^/my/todo.* $gdo/dashboard/todos?action_id=&author_id=&project_id=&state=pending&type= redirect;
rewrite ^/my/dashboard $gdo/dashboard redirect;
rewrite ^/my/milestones $gdo/dashboard/milestones redirect;
rewrite ^/my/todo.* $gdo/dashboard/todos?state=pending redirect;

rewrite ^/my/activity $tdo/my/activity redirect;
rewrite ^/my/bookmarks $tdo/my/activity/bookmarks redirect;
rewrite ^/my/messages $tdo/my/messages redirect;
rewrite ^/my/preferences $tdo/my/preferences redirect;
rewrite ^/my/profile $tdo/my/profile redirect;

return 403;
}


@@ -87,7 +91,7 @@ server {
ssl_certificate /srv/beta.devuan.org/etc/ssl/beta.crt.pem;
ssl_certificate_key /srv/beta.devuan.org/etc/ssl/beta.key.pem;
add_header X-Frame-Options SAMEORIGIN;
add_header Access-Control-Allow-Origin https://beta.devuan.org,https://talk.devuan.org;
add_header Access-Control-Allow-Origin https://beta.devuan.org,https://talk.devuan.org,https://git.devuan.org,https://devuan.org;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
add_header X-Content-Security-Policy "default-src 'self'; script-src 'self'; img-src 'self'";
add_header X-Content-Type-Options nosniff;


Loading…
Cancel
Save