Skip to content
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

Build and run on an M1 Mac #35

Open
bnowacky opened this issue Jan 31, 2023 · 8 comments
Open

Build and run on an M1 Mac #35

bnowacky opened this issue Jan 31, 2023 · 8 comments

Comments

@bnowacky
Copy link

Trying to get this running on my M1, and the docker build process is not working. I have used the quick build process as well as the detailed process.. Both with Docker.

Right now, I can get key cloak and redash running fine, but the forms-flow-webapi continues to fault and restart every 5 seconds, which also seems to force forms-flow-bpm to restart at the same interval + ~1s.

Has anyone gotten a full build running on an M1 ? I've made edits to Dockerfile to update a few dependancies and ass the --platform linux/amd64 to actually get the container to build, but still no luck.

Seeing if anyone else has had any luck running a local install on an M1 recently.

@Hafflgav
Copy link

Hafflgav commented Feb 2, 2023

I can just agree to what @bnowacky says. I have tried to run FormsFlow on my M1 Mac today and run into the exact same issue. Even trying to edit and run the shell script did not lead to a solution. It somehow always ends up in the described crash-loop.

@Hafflgav
Copy link

Hafflgav commented Feb 3, 2023

FYI, I somehow fixed that the web-api keeps crashing. Nevertheless, I still face problems with Camunda.
Here is a section of the error log:

forms-flow-bpm | 2023-02-03 12:20:43.582 ERROR 1 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'OAuth2LoginSecurityConfig': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setClientRegistrationRepository' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "http://192.168.1.52:8080/auth/realms/forms-flow-ai"

Seeing that you, @sumesh-aot did the last commit to fix the deployment for M1 - maybe you can help here? :)
Thank you a lot in advance!

@sumesh-aot
Copy link
Member

sumesh-aot commented Feb 3, 2023

@Hafflgav @bnowacky Were you using https://github.com/AOT-Technologies/forms-flow-ai-deployment/blob/main/docker-compose/docker-compose-arm64.yml ?
Quick installation won't work with M1 yet, we are working on it. For now, please use the above docker compose.

@Hafflgav
Copy link

Hafflgav commented Feb 6, 2023

Thanks for your reply @sumesh-aot!
Steps to reproduce my issue:

  • (fix) and run start.bash (replacing docker-compose.yml with docker-compose-arm64.yml)
    • choose not to install analytics
    • add correct ip-address
      This starts the docker container but results into the previously described problem

Second thing I tried out was:

  • Using the docker-compose-arm64.yml and starting it on its own.
    • Fails
  • Adding information from the sample.env to the .env file
    • Apparently this does not change anything

I tested the installation on my windows machine - it runs fine there. To me it seems that the windows script creates other .env variables. I want to try out whether manually changing them on MacOS helps.

@Hafflgav
Copy link

Hafflgav commented Feb 7, 2023

Hey @bnowacky - we managed to get forms-flow up and running.
Since it is rather a "workaround" we pushed it to one of our own repositories.

To me it seems that the .env variables & config.js is filled with the wrong attributes on startup. Especially since the bash script is not working.

There is also a readme in here who should tell you what exactly you need to do:
https://github.com/FlowSquad/miranum-consulting/tree/main/forms-flow-showcase/forms-flow-ai

Lmk if this solves your problem! :)
(Would be cool to get this officially fixed though)

@sumesh-aot
Copy link
Member

sumesh-aot commented Feb 8, 2023

@Hafflgav Thank you for the feedback. I have modified the script to pull correct IP address and to fix other issues. Could you please give a try and see if it's working on your end ?

@Hafflgav
Copy link

Hafflgav commented Feb 8, 2023

Hey @sumesh-aot! Thanks a lot for the update :)
When trying to run the script it complains about invalid identifies. This can easily be fixed by changing function names like "forms-flow-web" to "formsFlowWeb". Using "-" seems to be forbidden in function names.
(I wanted to push this to the branch but apparently do not have permissions to do so. :(

After having changed this I was able to run the script. I do not get container crashes anymore.
Though when logging into keycloak with the default login I do get a "Error: Request failed with status code 503"
So far I am not sure why this exactly happens.

I have noticed that

  • FORMIO_DEFAULT_PROJECT_URL=http://192.168.1.52:3001
    is not included in the .env file which is after having executed the .bat on windows.

Another thing I saw is that the keys in the config.js file have been in quotation marks.
Windows outputs:

window["_env_"] = {
    NODE_ENV:"production",
    REACT_APP_API_SERVER_URL:"http://192.168.1.52:3001",
    REACT_APP_API_PROJECT_URL:"http://192.168.1.52:3001",
    REACT_APP_KEYCLOAK_CLIENT:"forms-flow-web",
    REACT_APP_KEYCLOAK_URL_REALM:"forms-flow-ai",
    REACT_APP_KEYCLOAK_URL:"http://192.168.1.52:8080",
    REACT_APP_WEB_BASE_URL:"http://192.168.1.52:5000",
    REACT_APP_BPM_URL:"http://192.168.1.52:8000/camunda",
    REACT_APP_WEBSOCKET_ENCRYPT_KEY:"giert989jkwrgb@DR55",
    REACT_APP_APPLICATION_NAME:"formsflow.ai",
    REACT_APP_WEB_BASE_CUSTOM_URL:"",
    REACT_APP_USER_ACCESS_PERMISSIONS:{accessAllowApplications:false,accessAllowSubmissions:false}
};

Having changed these three things (identifiers in shell script, from default project url and config.js) leads to an accessible FormsFlow. 👍
Let me know what you think about these findings :)

@sumesh-aot
Copy link
Member

@Hafflgav Thanks again for the feedback.
I have a PR (#37) in place to fix the quote and identifier issue (works on my M1 without those changes, weird). Formio project URL was getting populated in all scenarios I tried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants