This is WIP POST
I followed below steps (https://roadie.io/blog/backstage-docker-service-catalog/) to install backstage on docker on Mac machine
Pre-requisite
- Installed Docker for Mac using https://docs.docker.com/docker-for-mac/install/
- Once installed, verify by running "docker" command on terminal.
- you will also need Docker compose which is a part of Docker desktop for Mac.
- Validate it is available by running "docker-compose" command on terminal
- Install node.js on Mac machine
- verify the insalled version by running "node -v" command on terminal.
- Install yarn on mac machine
- Verify installed version by running "yarn" command on terminal.
Step 1 - Scaffold a Backstage application
- Create a scaffold app
- Run "npx @backstage/create-app --version"
- Run "npx @backstage/create-app"
- Enter name of application "first-app"
- Use Database as "PostgreSQL"
- It will show "Successfully create first-app"
Step 2 - Building a Docker image
Now we will create docker image
- Go to packages directory of first-app
- run "cd first-app/packages"
- Here you will see 2 folders
- app
- backend
- Run command "yarn workspace backend build-image"
- This will take around 120 seconds. it will change based on internet speed.
- Check if docker image is created
- Run "docker images" command
- You should see repository "backstage" with 1.1Gb size.
- Now run this image
- Run "docker run backstage" command
- Here you will get an error about unable to connect "127.0.0.1:5432". It is expected as we have not started postgreSQL
Next step is to integrate backstage with LDAP.
There is no straight road to this solution. The details are discussed at https://github.com/backstage/backstage/issues/1807 page. In here they have discussed LDAP integration via keycloak (https://www.keycloak.org/). Below steps are followed to implement this
- Create docker image for keyCloak
- It is simple and mentioned https://www.keycloak.org/getting-started/getting-started-docker
- Run command "docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin quay.io/keycloak/keycloak:12.0.1"
- This will download and start the local docker for KeyCloak. The above command will take around 1 min to start image.
- You should be able to see admin panel
- http://localhost:8080/auth/admin
- Login with admin user with password as admin. This information is given while starting KeyCloak docker image.
- Create realm
- Enter the name and click on Create button
- This will redirect you to this new realm.
- Create User
- Click "users" in left hand menu
- Click on Click
Add user(top-right corner of table) - Fill in the form with the following values:
- Username:
Vikrant - First Name: Your first name
- Last Name: Your last name
- Click
Save - Create User Credential. The user will need an initial password set to be able to login. To do this:
- Click
Credentials(top of the page) - Fill in the
Set Passwordform with a password (Test123) - Click
ONnext toTemporaryto prevent having to update password on first login - Clock on "Set Password" button
- On creation you still see a new row with type password
- As user is created successfully, lets try to login with this new user
- open the realm which you have created above. Make sure the realm name is properly entered in URL.
- http://localhost:8080/auth/realms/InfosysKeyCloak/account
- enter username and password
- This should show you the home page for this user.
Create local image for OpenLDAP
- Get the "docker-compose.yml" file from https://github.com/osixia/docker-openldap/tree/stable/example location
- Store this file locally in a directory
- Open terminal. Navigate to the above directory.
- Run "docker-compose up" command. First time it will take couple of minutes to download the files and start 2 dockers
- You may face an issue of port for phpldapadmin container. Its port can be changed by modifying port under "phpldapadmin" image configuration.
- I have changed port to 8081
- Using the instructions mentioned on https://scytalelabs.com/setup-and-configure-openldap-using-docker-image-on-ubuntu-16-04/ page setup some configuration in openLdap
- Open php ldap admin
- open url : http://localhost:8081/
- Enter credentials
- username: cn=admin,dc=example,dc=org
- password: admin
Integrate keyCloak with Ldap serer
- For this i am following steps mentioned https://www.janua.fr/ldap-integration-with-keycloak/ page.
No comments:
Post a Comment