-
Notifications
You must be signed in to change notification settings - Fork 90
Improve cookiecutter and demo-site command #2564
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
base: master
Are you sure you want to change the base?
Improve cookiecutter and demo-site command #2564
Conversation
38a7369
to
5dfc6d5
Compare
e687066
to
d60d5b8
Compare
d60d5b8
to
602ce7d
Compare
@Tiago-Salles please include instructions to testing on the PR description. |
I think the following command execute the cookiecutter of run your PR: docker run --rm -it -u $(id -u):$(id -g) -v $PWD:/app fundocker/cookiecutter gh:Tiago-Salles/richie --directory cookiecutter --checkout Tiago-Salles/issues/274-upstream-cookiecutter |
Exactly @igobranco. I used a difference approach to develop, just stepping back and pointing to the directory of the project containing the changes, but this solution you provided is better, as it can be run from any branch. Thank you, I added to the PR description. |
cookiecutter/{{cookiecutter.organization}}-richie-site-factory/docker-compose.yml
Outdated
Show resolved
Hide resolved
cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Dockerfile
Outdated
Show resolved
Hide resolved
cookiecutter/{{cookiecutter.organization}}-richie-site-factory/Makefile
Outdated
Show resolved
Hide resolved
cookiecutter/{{cookiecutter.organization}}-richie-site-factory/docker-compose.yml
Outdated
Show resolved
Hide resolved
@Tiago-Salles Please include the "languages" has a cookiecutter question. Lines 473 to 501 in 5deda56
|
602ce7d
to
eef28c1
Compare
@Tiago-Salles review the commit message: From: To: Personally, I don't like the logo... why not replace with 🚩? You are just introducing flags... kind of... IMO questions of cookiecutter can be flags! |
1337c5e
to
f2de634
Compare
After creating the factory site and adding a site. The cookie cutter generated site factory Makefile isn't showing the help correctly:
cat .env
RICHIE_SITE=asa
ACTIVATED_DB=postgresql
DB_PORT=3306 When running the site it stops on the make run Error:
|
6a6976a
to
dd10fb2
Compare
dd10fb2
to
6fdaa1d
Compare
6fdaa1d
to
aa1a546
Compare
We are facing in this branch the same problem as highlighted in the collectstatic command is not being recognized. |
dd33a03
to
518adee
Compare
e138f13
to
2cc04de
Compare
...tter.organization}}-richie-site-factory/template/{{cookiecutter.site}}/requirements/base.txt
Outdated
Show resolved
Hide resolved
@Tiago-Salles After you change this, IMO is good enough to be merged. |
1f8c858
to
725a7d8
Compare
@igobranco I have made the changes you identified necessary, we are good to pass this on. @kernicPanel Please, could you review this PR? |
- Added org_dockerhub, nginx_image_name, nginx_image_tag and elasticsearch_image_name parameters to cookiecutter in order to obtain more flexiblity using the site factory
- Added in the activate script the possibility to select the database and the languages that the activating site will support. It also reflects in changes in the docker compose file in order to run the site with the selected database.
- Improved create demo site script to multilingual generation.
725a7d8
to
f7fea47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay.
LGTM 👍
@kernicPanel |
In quick words, this PR includes:
org_dockerhub
,nginx_image_name
,nginx_image_tag
, andelasticsearch_image_name
parameters to generate a site factory.create_demo_site
command script to support multilingual generation.Purpose
We at NAU identified the necessity to have more flexibility in terms of architecture using Richie.
For our instance we have been maintaining some changes to meet our needs, that we understand valuable to have upstream. Our instance runs with MySQL and the docker images come from our dockerhub.
This PR addresses these requirements, and provide more flexibility in terms of architecture.
How does it works
Since this PR deals with the site factory as well, it is necessary to generate a new site factory and after generate a new site.
Generate the site factory
To run the site-factory generation according to this proposal, execute this command in the root of the project:
It prompts four questions besides the current question organization:
org_dockerhub
: Which will the main dockerhub the project will pull the images, which if not provided it will use the defaultfundocker
.nginx_image_name
: the nginx image name, which if not provided it will use the defaultfundocker/openshift-nginx
.nginx_image_tag
: the nginx image tag, which if not provided it will use the default1.13
.elasticsearch_image_name
: the elasticsearch image name, which if not provided it will use the defaultfundocker/openshift-elasticsearch:6.6.2
.Generate the new site
In the root of the generated site factory, it is necessary to run
make add-site
providing the standard information and the second language this site will support.In order to have the
make demo-site
according to the changes made here, replace in thebase.txt
requirements file therichie
package withgit+https://github.com/Tiago-Salles/richie@Tiago-Salles/issues/274-upstream-cookiecutter#egg=richie
.Activate the new site
In the root of the site factory it is necessary to run
bin/activate
so it is possible to select the database. It is worth mentioning that this functionality also provides the possibility of switching the database engine for a running site. Select as well the languages that this site will support.Fill in the new site
Now, with the
richie
package replaced withgit+https://github.com/Tiago-Salles/richie@Tiago-Salles/issues/274-upstream-cookiecutter#egg=richie
in thebase.txt
of the new site, it is necessary to runmake bootstrap
and thenmake demo-site
.What happens in each step
Generate the site factory
All the answers will be used to the define infrastructure resources. These answers will be set on the files that manage the site-factory and site, such as
Makefile
,.circleci
folder, sitesettings.py
and the other similars ones.Generate the new site
This step adds to the questions, the second language this site will support.
Activate the new site
This step is focused only in the site. That is, all the content generated here will not impact at the site factory resources.
Besides the second language that already was set using cookiecutter, it is possible here to set more languages in the environment. This step is optinal, if none insterests exist on this, it can be skipped.

Here it sets in the
.env
the variables:RICHIE_SITE
: The site name.ACTIVATED_DB
: The site database engine which will be called in thedocker-compose.yml
file, being included as followingcorrespoding to the file in the root of the site factory
Where in each file is set their business logics as well their dependencies.
DB_PORT
: Automatically set in according to theACTIVATED_DB
variables, in instance of beingmysql
its value will be3306
. If the interest is to use another port, feel free to change the value setting a new one in the.env
file asDB_PORT={new_port}
.LANGUAGES
: The site supported languages. It will be called in thesettings.py
as followingImportant Observations
It is important to understand that only these mentioned steps are not enough, if on the activate site process was selected the Korean language as one of the languages the site will support, it to must have the
ko-KR.json
file in the./sites/{site_name}/src/frontend/i18n/locales/
, otherwise the frontend will not provide the possibility to use this language.By default the backend already provides this language content, but it is worth to check the corresponding language configuration is there as expected, by going to
./sites/{site_name}/src/backend/locale
and verifying.As already mentioned, it is important to replace the
richie
package withgit+https://github.com/Tiago-Salles/richie@Tiago-Salles/issues/274-upstream-cookiecutter#egg=richie
in thebase.txt
of the new site to have all this new features to work.