{"id":19571632,"url":"https://github.com/serlo/local-dev-env","last_synced_at":"2026-03-19T10:33:37.293Z","repository":{"id":64352666,"uuid":"565579937","full_name":"serlo/local-dev-env","owner":"serlo","description":"Scripts for running the main Serlo services in your local machine","archived":false,"fork":false,"pushed_at":"2024-04-08T12:23:27.000Z","size":140787,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-04-08T13:36:02.991Z","etag":null,"topics":["developer-tools","serlo"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serlo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-11-13T20:59:25.000Z","updated_at":"2023-08-22T13:16:59.000Z","dependencies_parsed_at":"2024-01-15T15:44:28.113Z","dependency_job_id":"809bb83f-f1b6-4b63-864d-5281a44c1c2c","html_url":"https://github.com/serlo/local-dev-env","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serlo%2Flocal-dev-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serlo%2Flocal-dev-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serlo%2Flocal-dev-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serlo%2Flocal-dev-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serlo","download_url":"https://codeload.github.com/serlo/local-dev-env/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240840032,"owners_count":19866164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","serlo"],"created_at":"2024-11-11T06:19:36.810Z","updated_at":"2026-03-19T10:33:37.253Z","avatar_url":"https://github.com/serlo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This repo was archived since the relevant code was migrated to [serlo/api.serlo.org](https://github.com/serlo/api.serlo.org)\n\n# serlo.org - Local Development Environment\n\nScripts for having the main backend services of the serlo.org environment in a local machine.\n\nRequirements:\n\n- UNIX System\n- Docker and Docker Compose\n- Nodejs and Yarn\n- Python 3 and pip\n\n```\nyarn\nyarn start\n# or `yarn start:detach` to have control of the terminal\n```\n\nTake a look `package.json` for useful scripts!\n\n## Integrating local Serlo frontend\n\n1. `cd $YOUR_FRONTEND_DIR`\n2. Make sure to use the local environment in `.env`\n\n```\nNEXT_PUBLIC_ENV=local\n# NEXT_PUBLIC_ENV=staging\n```\n\n3. `yarn dev`\n   _Note: every time you change `.env`, you have to rerun `yarn dev`_\n\n4. cd back to this repo directory and `cp localhost-graphql-fetch.ts \"$YOUR_FRONTEND_DIR/src/pages/api/frontend/localhost-graphql-fetch.ts\"` \u003c- important for doing authenticated actions, but _do not commit this change in frontend!_, in case you are also working there.\n\nIn case of registering new user head to `localhost:4436` to get the verification link.\n\n## Developing with Ory Kratos\n\n### Integrating with Keycloak\n\nFirst of all add `nbp` as host  \n`sudo bash -c \"echo '127.0.0.1\tnbp'\" \u003e\u003e /etc/hosts`\n\n_why do I need it? Kratos makes a request to the url of the oauth2 provider, but since its running inside a container, it can't easily use host port. nbp is a dns that is discoverable for the kratos container, so the host can use it also._\n\nRun `yarn start:nbp`.\n\nKeycloak UI is available on `nbp:11111` (username: admin, pw: admin).  \nThere you have to configure Serlo as a client.\n\n\u003e Client -\u003e Create Client\n\u003e\n\u003e ```\n\u003e id: serlo\n\u003e home and root url: http://localhost:3000\n\u003e redirect uri: http://localhost:4433/self-service/methods/oidc/callback/nbp\n\u003e ```\n\nGet the credentials and go to `kratos/config.yml`:\n\n```yaml\nselfservice:\n  methods:\n    oidc:\n      enabled: true\n      config:\n        providers:\n          - id: nbp\n            provider: generic\n            client_id: serlo\n            client_secret: \u003cput secret here\u003e\n```\n\nRun the local frontend (not forgetting to change in .env to local) to test.\n\nDocumentation:\n\n- Kratos\n  - [Configuration File](https://www.ory.sh/docs/kratos/reference/configuration)\n  - [General instructions](https://www.ory.sh/docs/kratos/social-signin/generic) (select 'Ory CLI')\n- [Keycloak](https://www.keycloak.org/docs/latest/server_admin/index.html#con-server-oidc-uri-endpoints_server_administration_guide)\n\n### Email templates\n\nKratos has to be rebuilt every time you change an email template. Use the following workflow:\n\n1. Edit templates.\n2. Run `yarn kratos:rebuild`\n3. Test the verification or the recovery email at `localhost:4436`. Repeat the process.\n\n### Writing an import script\n\nWe are still in the phase of importing data from the legacy database into the kratos one.  \nFrom now on let's prefer imports using python for the simple reason that\nwe want to use the very same script in terraform and terraform template files\nthe $ may interfere with javascript $ in string interpolation.\n\n```\n$ python3 -m venv .venv\n$ source .venv/bin/activate\n(.venv) $ pip install -r requirements.txt\n(.venv) $ python3 path/to/import/script\n...\n# when you are done\n(.venv) $ deactivate\n$\n```\n\n## Developing with Rocket Chat\n\n1.\n\n```console\n$ yarn start:chat -d # or start:chat:kratos:db-layer if you're developing in api at the same time\n# wait +- 1 minute\n$ yarn prepare:rocket-chat\nRegistering rocket chat as client in hydra\n\nCLIENT ID a6c3e143-****** # It will be different every time\nCLIENT SECRET rocket.chat\n```\n\nCopy the client Id.  \n2. Rocket chat will be available in `localhost:3030`. Log in as admin using the username `dev` and password `123456`.  \n3. Go to three dots -\u003e Administration -\u003e Workspace -\u003e Settings -\u003e OAuth2 -\u003e Serlo and paste the client id that you got earlier in the `id`.  \n4. `sudo bash -c \"echo '127.0.0.1 hydra' \u003e\u003e /etc/hosts\"`. This step is optional, but quite handy. Downside: at the end you are not going to see yourself inside of the rocket chat, because of dns name clash with the container.  \n5. Logout and click on Serlo. You are going to be redirected to `http://hydra:4444...`. If you haven't done step 4, just change `hydra` with `localhost`.\n\nNote that while developing you may want to change the links to chat in some files of frontend (`https://community.serlo.org` to `http://localhost:3030`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserlo%2Flocal-dev-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserlo%2Flocal-dev-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserlo%2Flocal-dev-env/lists"}