Commit db1fbfd3 authored by agata's avatar agata

Merge branch 'magutt' of git.autistici.org:ai/website into magutt

parents d366bf43 cc109085
...@@ -2,7 +2,6 @@ image: docker:latest ...@@ -2,7 +2,6 @@ image: docker:latest
stages: stages:
- build - build
- docker_build
- release - release
services: services:
...@@ -13,27 +12,12 @@ variables: ...@@ -13,27 +12,12 @@ variables:
RELEASE_TAG: $CI_REGISTRY_IMAGE:latest RELEASE_TAG: $CI_REGISTRY_IMAGE:latest
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
build:
stage: build
image: "debian:stretch"
script:
- apt-get -q update && apt-get -y install golang git
- ./scripts/lint.sh
- ./scripts/update.sh
- tar -c -z -f site.tgz public index templates
artifacts:
paths:
- site.tgz
docker_build: docker_build:
stage: docker_build stage: build
script: script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org
- tar -x -z -f site.tgz -C docker
- docker build --build-arg ci_token=$CI_JOB_TOKEN --pull -t $IMAGE_TAG docker - docker build --build-arg ci_token=$CI_JOB_TOKEN --pull -t $IMAGE_TAG docker
- docker push $IMAGE_TAG - docker push $IMAGE_TAG
dependencies:
- build
release: release:
stage: release stage: release
......
FROM debian:stable AS build
ADD . /src
RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends rsync git golang ca-certificates && cd /src && ./scripts/lint.sh && ./scripts/update.sh
FROM registry.git.autistici.org/ai3/docker/apache2-base:master
COPY --from=build /src/public /var/www/autistici.org
COPY --from=build /src/build/bin/sitesearch /usr/sbin/sitesearch
COPY --from=build /src/index /var/lib/sitesearch/index
COPY templates /var/lib/sitesearch/templates
COPY docker/conf /tmp/conf
COPY docker/build.sh /tmp/build.sh
RUN /tmp/build.sh && rm /tmp/build.sh
ENTRYPOINT ["/usr/local/bin/chaperone"]
...@@ -71,6 +71,21 @@ The resulting HTML pages will be found in the `public` directory. ...@@ -71,6 +71,21 @@ The resulting HTML pages will be found in the `public` directory.
## How to run a test webserver ## How to run a test webserver
### Docker
The preferred way, which avoids installing an entire Debian
distribution, would be to use Docker. Build the image with:
$ docker build -t ai-website .
and run it with:
$ docker run -P 8080
it should then be visible at http://localhost:8080/.
### debootstrap
To check the results of your edits, it is useful to start a local To check the results of your edits, it is useful to start a local
webserver to inspect the generated HTML pages. In general, you webserver to inspect the generated HTML pages. In general, you
might want to avoid installing the Apache packages on your local might want to avoid installing the Apache packages on your local
......
FROM registry.git.autistici.org/ai3/docker/apache2-base:master
COPY public /var/www/autistici.org
COPY index /var/lib/sitesearch/index
COPY templates /var/lib/sitesearch/templates
COPY conf /tmp/conf
COPY build.sh /tmp/build.sh
RUN /tmp/build.sh && rm /tmp/build.sh
ENTRYPOINT ["/usr/local/bin/chaperone"]
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
BUILD_PACKAGES="rsync" BUILD_PACKAGES="rsync"
# Packages required to serve the website and run the services. # Packages required to serve the website and run the services.
# We have to keep the python3 packages around in order to run PACKAGES=""
# chaperone (installed via pip).
PACKAGES="ai-webtools"
APACHE_MODULES_ENABLE=" APACHE_MODULES_ENABLE="
headers headers
...@@ -24,10 +22,6 @@ APACHE_MODULES_ENABLE=" ...@@ -24,10 +22,6 @@ APACHE_MODULES_ENABLE="
proxy_http proxy_http
" "
APACHE_SITES="
main
"
# The default bitnami/minideb image defines an 'install_packages' # The default bitnami/minideb image defines an 'install_packages'
# command which is just a convenient helper. Define our own in # command which is just a convenient helper. Define our own in
# case we are using some other Debian image. # case we are using some other Debian image.
...@@ -37,21 +31,16 @@ if [ "x$(which install_packages)" = "x" ]; then ...@@ -37,21 +31,16 @@ if [ "x$(which install_packages)" = "x" ]; then
} }
fi fi
# Install the main A/I package repository.
install_packages curl gnupg
echo "deb http://deb.autistici.org/urepo stretch-ai/" > /etc/apt/sources.list.d/ai.list
curl -s http://deb.autistici.org/repo.key | apt-key add -
apt-get -q update
set -e set -e
umask 022
install_packages ${BUILD_PACKAGES} ${PACKAGES} install_packages ${BUILD_PACKAGES} ${PACKAGES}
chmod -R go-w /tmp/conf
rsync -a /tmp/conf/ /etc/ rsync -a /tmp/conf/ /etc/
# Setup Apache. # Setup Apache.
a2enmod -q ${APACHE_MODULES_ENABLE} a2enmod -q ${APACHE_MODULES_ENABLE}
a2ensite ${APACHE_SITES}
# Make sure that files are readable. # Make sure that files are readable.
chmod -R a+rX /var/lib/sitesearch chmod -R a+rX /var/lib/sitesearch
......
...@@ -34,12 +34,6 @@ ...@@ -34,12 +34,6 @@
# Rewrite rules are used to preserve the old links. # Rewrite rules are used to preserve the old links.
RewriteEngine On RewriteEngine On
# Force HTTPS for all URLs, unless you are connecting
# to the hidden service.
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteCond %{HTTP_HOST} !\.onion$
RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1$2 [R,L]
# Remove the old language prefix from the URLs. # Remove the old language prefix from the URLs.
RewriteRule ^/(it|en|cat|de|es|pt|fr)/(.*)$ /$2 [R=301,L] RewriteRule ^/(it|en|cat|de|es|pt|fr)/(.*)$ /$2 [R=301,L]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment