Docker is used to develop, test, and improve an environment.
- Install docker
- Install docker-compose if you are using Linux
- Install python (version 3.8)
- Install pipenv (python package manager)
- Install Node (version 12+)
- Install yarn (version 1.22.+)
- Install AWS CLI (version 1.22.+)
make setup & ☕
You will find a more detailed documentation in ./frontend/schemaCMS, ./frontend/schemaUI, ./backend/app and ./docs
-
Create Auth0 tenant for local use. You can find instructions here.
-
Copy
local.env-examplefile aslocal.envand fill missingAuth0envs using values from your tenant:cp local.env-example local.env
-
Run backend services:
make up
NOTE: Check if you have any running containers using the same ports as Schema CMS components, if yes please stop/kill those; you can check running containers using a
docker pscommand and stop/kill selected container usingdocker stop/kill CONTAINER ID -
Run frontend:
make fe-up
Backend is running on localhost:8000
MailCatcher is running on localhost:1080
Documentations is running on localhost:8001
Frontend is running on localhost:3000
-
In a new browser tab go to
http://localhost:1080/ -
In a second tab open
http://localhost:8000/admin/and login as a root user, you can set a root password in thelocal.env, changing value ofDJANGO_ROOT_PASSWORDbut the default password is set toroot12345 -
Now go to a
Userstab and click theINVITE USERbutton, fill all required fields andSAVE.NOTE: You can use dummy email if you want because locally we don't send any emails.
-
Go to a tab from step 1. You should see an invitation email with a password change link. Click it and set the password.
-
After the password is set you can go to the
http://localhost:3000and login using invited user credentials.NOTE: You won't be able to login to app if you don't set password.
NOTE: If Gmail email address was used you can log-in to app using
Sign in with Googleoption.
- Go to the
http://localhost:8000/admin/->Users - click on the user whose role you want to change
- in a
Permissionssection you will find a dropdown with available roles, choose one andSAVE - after the role was changed you need to login again
Available API calls are listed on this page
This project uses AWS CDK for easy deployment application on any AWS account.
To easy manage multiple AWS accounts project uses aws-vault.
Application requires Auth0 and domain with verified certificate in AWS.
- Make sure you run
make setupand you have all packages installed. - aws-vault installed.
- Create and configure Auth0 or Okta identity provider tenant depending what you want to use. You can find instructions for Auth0 here and Okta here.
- Log In to AWS Console, go to
My security credentialsand create access key. - Use created access key to add new profile in aws-vault.
- Edit file
~/.aws/configby adding lineregion=<selected-deployment-region>under profile you added. - Update
profileandregionin.project_config.json.
Since DockerHub limited pulling images for non-register users we need use logged user during deploying SchemaCMS, thats
why before deployment we need add in AWS Secrets Manager two secrets:
DOCKER_USERNAME and DOCKER_PASSWORD.
DockerHub account is available to create here.
From project root directory:
make deploy-inframake deploy-components
-
Go to AWS Certificate Manager on selected region.
-
Validate certificate using DNS. You can follow this guide.
NOTE: As domain names please enter two records. First is just your domain name and second is wild card name with asterisk (*.example.com), this allow protect all subdomains.
-
Wait till
statusisIssued.
Amazon Simple Email Service is used by Schema CMS to send emails.
Unfortunately AWS SES is in Sandbox mode as default and because of that you can only send mail to and from verified email addresses and domains.
User has to request a change from Sandbox to Production mode. For more information look here.
But before that at least one domain has to be verified. To do that follow this steps:
- Go to AWS SES on selected region.
- Follow this guide.
- When domain
Verification Statuswill change toverifiedyou have to request moving out fromSandboxmode.
NOTE: Processing this request may take up to 2 days, depending which tier of AWS Support your account is using.
NOTE: Before AWS SES will be moved to Production mode mails can be send only to verified email addresses. You can verify emails following this guide
- Copy file
infra/ssm_parameters.example.jsonasinfra/ssm_parameters.json. - Fill parameters values.
/schema-cms-app/CERTIFICATE_ARN- useARNof certificate validated in previous step. You can find it inDetailsof your this certificate here./schema-cms-app/DJANGO_DEBUG-onif you want to see debug messages when error happensoffif not./schema-cms-app/DJANGO_DEFAULT_FROM_EMAIL- Verified domain email address that will be used to send emails for exampleadmin@example.com./schema-cms-app/DOMAIN_NAME- Domain that will be used to deploy Schema CMS e.g,example.com./schema-cms-app/DJANGO_HOST- Domain withhttps://e.g,https://example.com./schema-cms-app/DJANGO_WEBAPP_HOST- At this moment same value asDJANGO_HOST./schema-cms-app/PUBLIC_API_URL- Subdomainapie.g,https://api.example.com/with/on the end./schema-cms-app/DJANGO_ROOT_PASSWORD- Your password do django admin console./schema-cms-app/DJANGO_USER_MGMT_BACKEND- Setschemacms.users.backend_management.auth0.Auth0UserManagementif you want to use Auth0 as identity provider orschemacms.users.backend_management.okta.OktaUserManagementif you want use Okta./schema-cms-app/DJANGO_SOCIAL_AUTH_AUTH0_DOMAIN- Empty string if you be using Okta else set here domain from created Auth0SINGLE PAGE APPLICATION./schema-cms-app/DJANGO_SOCIAL_AUTH_AUTH0_KEY"- Empty string if you be using Okta else set here client ID from created Auth0SINGLE PAGE APPLICATION./schema-cms-app/DJANGO_SOCIAL_AUTH_AUTH0_SECRET"- Empty string if you be using Okta else set here client Secret from created Auth0SINGLE PAGE APPLICATION./schema-cms-app/DJANGO_USER_MGMT_AUTH0_DOMAIN- Empty string if you be using Okta else set here domain from created Auth0MACHINE TO MACHINE./schema-cms-app/DJANGO_USER_MGMT_AUTH0_KEY- Empty string if you be using Okta else set here client ID from created Auth0MACHINE TO MACHINE./schema-cms-app/DJANGO_USER_MGMT_AUTH0_SECRET- Empty string if you be using Okta else set here client Secret from created Auth0MACHINE TO MACHINE./schema-cms-app/SOCIAL_AUTH_OKTA_OAUTH2_KEY- Empty string if you be using Auth0 else set here client key from web app created in Okta./schema-cms-app/SOCIAL_AUTH_OKTA_OAUTH2_SECRET- Empty string if you be using Auth0 else set here client secret from web app created in Okta./schema-cms-app/OKTA_DOMAIN_URL- Empty string if you be using Auth0 else set here domain url to your Okta instance, for examplehttps://dev-7777777.okta.com./schema-cms-app/OKTA_API_TOKEN- Empty string if you be using Auth0 else set here created API token to your instance.
From project root directory:
- Run
make buildto create and push docker images with application to AWS ECR. This step may take some time. - After successful build run
make deploy-app. This step may take some time. - When
deploy-appstep is done, you need find Load Balancer DNS name record in outputs, that looks similar to:schema-cms-api.ApiServiceLoadBalancerDNSBF9EB7FC = schem-ApiSe-1PMWRS8JQDZ21-901620558.us-west-2.elb.amazonaws.com- or go to list of load balancers on selected region in AWS Console and copy
DNS namefrom Schema load balancer
- Add to your DNS
CNAMErecords pointing your domain andapisubdomain to Load Balancer DNS name.
During first deployment AWS CodePipeline and AWS CodeBuild were deployed. Those services allow easily deploy selected branch,tag, commit etc. of Schema CMS. To deploy selected version of Schema CMS:
- Go to AWS CodeBuild on region where Schema CMS was deployed.
- Enter to
SchemaCMSbuild project. - Click
Start build. - Put version you want deploy in
Source version - optionalfiled. - Click
Start build.
App will start deploying after couple of seconds. To monitor progress of deployment go to AWS CodePipeline
and enter schema-cms-pipeline.
NOTE: When
Buildstage is done nextDeploystage needsmanual approvalto run.Approvebutton will appear onapprove changesblock. Approve to finish deployment. .
To see logs you can use Cloud Watch to monitor the logs for Lambda functions and the Django application.
After new SchemaCMS version is released to master.
Build backend public image:
cd backend/app
aws-vault exec <profile to base schema aws account> -- make push-image-to-public-repoBuild frontend public image:
cd nginx
aws-vault exec <profile to base schema aws account> -- make push-image-to-public-repoBuild workers lambda zip:
cd backend/functions/workeres
make pack
aws-vault exec <profile to base schema aws account> -- make push-to-publicBuild workers lambda zip:
cd backend/functions/image_resize
make pack
aws-vault exec <profile to base schema aws account> -- make push-to-public