Skip to content

Commit

Permalink
copy docker setup from superdesk repo
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Nov 4, 2022
1 parent 4c33615 commit cd3ff29
Show file tree
Hide file tree
Showing 31 changed files with 190 additions and 623 deletions.
4 changes: 4 additions & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules
**/dist
**/package-lock.json
data
25 changes: 25 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# BUILD
FROM node:12 AS build

# install client
WORKDIR /tmp/client
COPY . .
RUN npm install --no-audit --unsafe-perm
RUN npm run build

# DEPLOY
FROM nginx

# setup the environment
WORKDIR /opt/superdesk/client/dist

# build client
COPY --from=build /tmp/client/dist ./

RUN rm /etc/nginx/conf.d/default.conf
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/superdesk_vhost.conf /etc/nginx/sites-enabled/superdesk.conf
COPY ./docker/start.sh /opt/superdesk/start.sh

ENTRYPOINT [ "/opt/superdesk/start.sh" ]
CMD ["nginx", "-g daemon off;"]
4 changes: 1 addition & 3 deletions docker/nginx.conf → client/docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,4 @@ http {

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

daemon off;
}
13 changes: 9 additions & 4 deletions docker/start.sh → client/docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#!/bin/bash
cd /opt/superdesk/client/dist &&
set -e

cd /opt/superdesk/client/dist

# replace default client config with env vars
sed -i \
-e "s/http:\/\/localhost:5000\/api/$(echo $SUPERDESK_URL | sed 's/\//\\\//g')/g" \
-e "s/ws:\/\/localhost:5100/$(echo $SUPERDESK_WS_URL | sed 's/\//\\\//g')/g" \
-e "s/ws:\/\/0.0.0.0:5100/$(echo $SUPERDESK_WS_URL | sed 's/\//\\\//g')/g" \
-e 's/iframely:{key:""}/iframely:{key:"'$IFRAMELY_KEY'"}/g' \
app*.js &&
nginx &
app*.js

which nginx

cd /opt/superdesk && sleep 5 && bash honcho start
exec "$@"
25 changes: 19 additions & 6 deletions docker/superdesk_vhost.conf → client/docker/superdesk_vhost.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
upstream superdesk_docker {
server localhost:5000;
upstream superdesk_api {
server superdesk-server:5000;
}

upstream superdesk_ws_docker {
server localhost:5100;
upstream superdesk_ws {
server superdesk-server:5100;
}

upstream superdesk_capi {
server superdesk-server:5400;
}

server {
server_name "";

location /ws {
proxy_pass http://superdesk_ws_docker;
proxy_pass http://superdesk_ws;
proxy_http_version 1.1;
proxy_buffering off;
proxy_read_timeout 3600;
Expand All @@ -19,8 +23,17 @@ server {
proxy_set_header Host $host;
}

location /capi {
proxy_pass http://superdesk_capi;
proxy_redirect off;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api {
proxy_pass http://superdesk_docker;
proxy_pass http://superdesk_api;
proxy_redirect off;

proxy_set_header Host $http_host;
Expand Down
2 changes: 1 addition & 1 deletion client/superdesk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function(grunt) {
},

publisher: {
protocol: 'https',
protocol: 'http',
tenant: process.env.PUBLISHER_API_SUBDOMAIN || '',
domain: process.env.PUBLISHER_API_DOMAIN || 'localhost',
base: 'api/v2',
Expand Down
64 changes: 64 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
version: "3.2"
services:

mongodb:
image: mongo:4
networks:
- superdesk

redis:
image: redis:3
networks:
- superdesk

elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
environment:
- discovery.type=single-node
networks:
- superdesk

superdesk-server:
build: ./server
depends_on:
- redis
- mongodb
- elastic
environment:
- SUPERDESK_URL=http://localhost:8080/api
- DEMO_DATA=1 # install demo data, set to 0 if you want clean install
- WEB_CONCURRENCY=2
- SUPERDESK_CLIENT_URL=http://localhost:8080
- CONTENTAPI_URL=http://localhost:8080/capi
- MONGO_URI=mongodb://mongodb/superdesk
- CONTENTAPI_MONGO_URI=mongodb://mongodb/superdesk_capi
- PUBLICAPI_MONGO_URI=mongodb://mongodb/superdesk_papi
- LEGAL_ARCHIVE_URI=mongodb://mongodb/superdesk_legal
- ARCHIVED_URI=mongodb://mongodb/superdesk_archive
- ELASTICSEARCH_URL=http://elastic:9200
- ELASTICSEARCH_INDEX=superdesk
- CELERY_BROKER_URL=redis://redis:6379/1
- REDIS_URL=redis://redis:6379/1
- DEFAULT_TIMEZONE=Europe/Prague
- SECRET_KEY=secretkey
# More configuration options can be found at https://superdesk.readthedocs.io/en/latest/settings.html
networks:
- superdesk

superdesk-client:
build: ./client
environment:
# If not hosting on localhost, change these lines
- SUPERDESK_URL=http://localhost:8080/api
- SUPERDESK_WS_URL=ws://localhost:8080/ws
- IFRAMELY_KEY
depends_on:
- superdesk-server
ports:
- "8080:80"
networks:
- superdesk

networks:
superdesk:
driver: bridge
1 change: 0 additions & 1 deletion docker/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions docker/Procfile-dev

This file was deleted.

2 changes: 0 additions & 2 deletions docker/README.md

This file was deleted.

47 changes: 0 additions & 47 deletions docker/common.yml

This file was deleted.

112 changes: 0 additions & 112 deletions docker/container_build.sh

This file was deleted.

Loading

0 comments on commit cd3ff29

Please sign in to comment.