-
Notifications
You must be signed in to change notification settings - Fork 27
Add a development setup #29
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
Open
tomasr8
wants to merge
2
commits into
indico:master
Choose a base branch
from
tomasr8:dev-container
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
data/* | ||
indico-prod/data/* | ||
indico-dev/data/* | ||
|
||
# IDE files | ||
.idea/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## DB config | ||
## =========================================== | ||
PGHOST=indico-postgres | ||
PGUSER=indico | ||
PGPASSWORD=indicopass | ||
PGDATABASE=indico | ||
|
||
## Celery | ||
## =========================================== | ||
C_FORCE_ROOT=true | ||
|
||
## Nginx | ||
## =========================================== | ||
NGINX_PORT=8080 | ||
# Should match the 'BASE_URL' in indico.conf | ||
NGINX_SERVER_NAME=localhost:8080 | ||
|
||
## Indico | ||
## =========================================== | ||
# Path to the indico.conf file | ||
INDICO_CONFIG=indico.conf | ||
|
||
## Transifex | ||
## =========================================== | ||
# If not specified, the translations are pulled from a public mirror | ||
TRANSIFEX_API_TOKEN= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
version: "3" | ||
services: | ||
# The main Indico container which runs flask | ||
# The same image is also used to run celery | ||
indico-web: &indico-web | ||
build: worker | ||
command: /opt/indico/run_indico.sh | ||
depends_on: | ||
- indico-redis | ||
- indico-celery | ||
environment: | ||
- PGHOST=${PGHOST} | ||
- PGUSER=${PGUSER} | ||
- PGPASSWORD=${PGPASSWORD} | ||
- PGDATABASE=${PGDATABASE} | ||
- C_FORCE_ROOT=${C_FORCE_ROOT} | ||
- TRANSIFEX_API_TOKEN=${TRANSIFEX_API_TOKEN} | ||
networks: | ||
- backend | ||
- frontend | ||
ports: | ||
# Indico is accessible either via nginx (localhost:8080 by default), or | ||
# directly via localhost:9090. In that case, static assets are served by flask | ||
- "9090:59999" | ||
# Maildump is accessible at localhost:60000 | ||
- "60000:60000" | ||
volumes: | ||
- 'archive:/opt/indico/archive' # file storage | ||
- 'customization:/opt/indico/custom' | ||
- 'static-files:/opt/indico/static' | ||
- './data/indico/log:/opt/indico/log' # logs | ||
- type: bind | ||
source: ${INDICO_CONFIG} | ||
target: /opt/indico/etc/indico.conf | ||
read_only: true | ||
tmpfs: | ||
- /opt/indico/tmp | ||
# Indico celery | ||
indico-celery: | ||
<<: *indico-web | ||
command: /opt/indico/run_celery.sh | ||
depends_on: | ||
- indico-redis | ||
networks: | ||
- backend | ||
ports: [] | ||
# Redis | ||
indico-redis: | ||
image: redis | ||
networks: | ||
- backend | ||
volumes: | ||
- './data/redis:/data' | ||
# Postgres | ||
indico-postgres: | ||
image: centos/postgresql-13-centos7 | ||
environment: | ||
- POSTGRESQL_USER=${PGUSER} | ||
- POSTGRESQL_PASSWORD=${PGPASSWORD} | ||
- POSTGRESQL_DATABASE=${PGDATABASE} | ||
- POSTGRESQL_ADMIN_PASSWORD=${PGPASSWORD} | ||
networks: | ||
- backend | ||
# Nginx proxy | ||
# Indico can be accessed via localhost:8080 | ||
indico-nginx: | ||
build: nginx | ||
environment: | ||
- NGINX_SERVER_NAME=${NGINX_SERVER_NAME} | ||
networks: | ||
- frontend | ||
ports: | ||
- "${NGINX_PORT:-8080}:8080" | ||
volumes: | ||
- 'static-files:/opt/indico/static:ro' | ||
- './data/nginx/log:/var/log/nginx' # logs | ||
volumes: | ||
archive: | ||
static-files: | ||
customization: | ||
networks: | ||
backend: {} | ||
frontend: {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# General settings | ||
SQLALCHEMY_DATABASE_URI = 'postgresql://indico:indicopass@indico-postgres:5432/indico' | ||
SECRET_KEY = 'super_secret_random_key' | ||
BASE_URL = 'http://localhost:8080' | ||
|
||
DEFAULT_TIMEZONE = 'Europe/Zurich' | ||
DEFAULT_LOCALE = 'en_GB' | ||
|
||
REDIS_CACHE_URL = 'redis://indico-redis:6379/0' | ||
CELERY_BROKER = 'redis://indico-redis:6379/1' | ||
|
||
ENABLE_ROOMBOOKING = True | ||
|
||
LOG_DIR = '/opt/indico/log' | ||
TEMP_DIR = '/opt/indico/tmp' | ||
CACHE_DIR = '/opt/indico/cache' | ||
CUSTOMIZATION_DIR = '/opt/indico/custom' | ||
|
||
STORAGE_BACKENDS = {'default': 'fs:/opt/indico/archive'} | ||
ATTACHMENT_STORAGE = 'default' | ||
|
||
PLUGINS = {'previewer_code', 'vc_zoom', 'payment_manual'} | ||
|
||
# Development settings | ||
DB_LOG = True | ||
DEBUG = True | ||
SMTP_USE_CELERY = False | ||
LOCAL_MODERATION = True | ||
|
||
NO_REPLY_EMAIL = '[email protected]' | ||
SUPPORT_EMAIL = '[email protected]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM nginxinc/nginx-unprivileged:stable-alpine | ||
|
||
USER root | ||
|
||
RUN set -ex && \ | ||
apk add --update py-pip unzip && \ | ||
rm -rf /var/cache/apk/* | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
EXPOSE 8080 | ||
|
||
# OpenShift runs containers using an arbitrarily assigned user ID for security reasons | ||
# This user is always in the root group so it is needed to grant privileges to group 0. | ||
RUN chgrp -R 0 /var/* /etc/nginx && chmod -R g+rwX /var/* /etc/nginx | ||
|
||
COPY run_nginx.sh indico.conf.template / | ||
RUN chmod +x /run_nginx.sh | ||
|
||
ENTRYPOINT ["/run_nginx.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
server { | ||
# localhost:8080 is the main entrypoint of this docker-compose setup | ||
listen 8080; | ||
listen [::]:8080; | ||
server_name ${NGINX_SERVER_NAME}; | ||
|
||
access_log /var/log/nginx/access.log combined; | ||
access_log /dev/stdout combined; | ||
error_log /var/log/nginx/error.log info; | ||
error_log stderr info; | ||
|
||
root /var/empty; | ||
|
||
sendfile on; | ||
|
||
# Serve static files | ||
location ~ ^/(images|fonts)(.*)/(.+?)(__v[0-9a-f]+)?\.([^.]+)$ { | ||
alias /opt/indico/static/$1$2/$3.$5; | ||
} | ||
|
||
location ~ ^/(css|dist|images|fonts)/(.*)$ { | ||
alias /opt/indico/static/$1/$2; | ||
} | ||
|
||
location / { | ||
# indico-web is the container running Indico | ||
proxy_pass http://indico-web:59999; | ||
proxy_set_header Host $server_name; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
envsubst '\$NGINX_SERVER_NAME' < /indico.conf.template > /etc/nginx/conf.d/indico.conf | ||
nginx -g "daemon off;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[https://www.transifex.com] | ||
api_hostname = https://api.transifex.com | ||
hostname = https://www.transifex.com | ||
username = api | ||
rest_hostname = https://rest.api.transifex.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
FROM python:3.12-alpine | ||
|
||
ENV INDICO_VIRTUALENV="/opt/indico/.venv" INDICO_CONFIG="/opt/indico/etc/indico.conf" | ||
|
||
ARG pip="${INDICO_VIRTUALENV}/bin/pip" | ||
|
||
USER root | ||
|
||
# Install dependencies | ||
RUN set -ex && apk update && \ | ||
apk add --no-cache libpq-dev postgresql-client vim less bash curl gettext git nodejs npm zip wget \ | ||
gcc g++ make musl-dev linux-headers mupdf-dev freetype-dev pango | ||
# gcc, g++, make, musl-dev, linux-headers, mupdf-dev and freetype-dev are needed to build some python and/or node libraries | ||
|
||
# Install maildump | ||
RUN pip install --no-cache-dir pipx && \ | ||
pipx install maildump && \ | ||
pip uninstall pipx -y | ||
|
||
# Create a virtual environment | ||
RUN python -m venv ${INDICO_VIRTUALENV} | ||
RUN ${pip} install --no-cache-dir --upgrade pip uwsgi | ||
|
||
# Install the Transifex client | ||
RUN mkdir -p /opt/tx | ||
RUN cd /opt/tx && curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | ||
|
||
WORKDIR /opt/indico | ||
|
||
# Clone indico | ||
RUN git clone https://github.com/indico/indico.git src --depth 1 | ||
|
||
# Clone indico-plugins | ||
RUN git clone https://github.com/indico/indico-plugins.git indico-plugins --depth 1 | ||
|
||
# Install requirements | ||
RUN cd /opt/indico/src && ${pip} install --no-cache-dir -e '.[dev]' | ||
RUN for dir in /opt/indico/indico-plugins/*/; do (cd "${dir}" && ${pip} install --no-cache-dir -e '.[dev]'); done | ||
|
||
# Run webpack for indico and plugins | ||
RUN cd /opt/indico/src && npm ci && \ | ||
${INDICO_VIRTUALENV}/bin/python ./bin/maintenance/build-assets.py indico --dev && \ | ||
${INDICO_VIRTUALENV}/bin/python ./bin/maintenance/build-assets.py all-plugins --dev /opt/indico/indico-plugins && \ | ||
npm cache clean --force | ||
|
||
RUN ["/bin/bash", "-c", "mkdir -p --mode=775 /opt/indico/{etc,tmp,log,cache,archive}"] | ||
|
||
RUN ${INDICO_VIRTUALENV}/bin/indico setup create-symlinks /opt/indico | ||
RUN ${INDICO_VIRTUALENV}/bin/indico setup create-logging-config /opt/indico/etc | ||
|
||
COPY .transifexrc /opt/indico/etc/ | ||
|
||
WORKDIR /opt/indico | ||
|
||
# uwsgi & maildump ports | ||
EXPOSE 59999 60000 | ||
|
||
COPY uwsgi.ini /etc/uwsgi.ini | ||
|
||
COPY run_indico.sh run_celery.sh pull_translations.sh run_initial_setup.py /opt/indico/ | ||
RUN chmod 755 /opt/indico/*.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $TRANSIFEX_API_TOKEN ]]; then | ||
echo "Transifex API token not provided" | ||
echo "Pulling translations from a mirror..." | ||
cd /opt/indico/src | ||
wget --tries=5 https://test-indico-transifex-mirror.app.cern.ch/translations.zip | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to pull from mirror" | ||
exit 1 | ||
fi | ||
unzip translations.zip | ||
# Delete existing translations | ||
rm -R indico/translations/*/ | ||
# Move the current translations | ||
mv translations/* indico/translations/ | ||
rm -r translations | ||
else | ||
echo "Transifex API token provided" | ||
echo "Pulling translations from Transifex..." | ||
cd /opt/indico/src && /opt/tx/tx --token=$TRANSIFEX_API_TOKEN --root-config=/opt/indico/etc/.transifexrc pull --all -f | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
. /opt/indico/.venv/bin/activate | ||
|
||
check_db_ready() { | ||
psql -c 'SELECT COUNT(*) FROM events.events' | ||
} | ||
|
||
# Wait until the DB becomes ready | ||
check_db_ready | ||
until [ $? -eq 0 ]; do | ||
echo "Waiting for DB to be ready..." | ||
sleep 10 | ||
check_db_ready | ||
done | ||
|
||
echo 'Starting Celery...' | ||
indico celery worker -B |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.