-
Notifications
You must be signed in to change notification settings - Fork 87
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
Improve cookiecutter and demo-site command #2564
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
e6e2931
to
93fd21c
Compare
- 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
2d95df6
to
2c29536
Compare
- 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.
a42a61f
to
5ab7558
Compare
- Improved create demo site script to multilingual generation.
5ab7558
to
7d0c48e
Compare
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.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, from the images to the dockerhub. These answers will be set on the files that manages the site-factory and site, such as
Makefile
,.circleci
folder, sitesettings.py
and the other similars ones.Generate the new site
This step was not impacted, so it continues being the same.
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.
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 siite factory
Where in each file is set their business logics as well their dependencies.
DB_PORT
: Automatically site 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.