Vegz78 / McAirpos

MakeCode Arcade games in RetroPie, Recalbox 7/8 and Batocera, running natively as ELF executables on Raspberry Pi OS/Linux ARM with 1-2 gamepads
https://Vegz78.github.io/McAirpos
MIT License
80 stars 10 forks source link

Add Ansible deployment playbook for Recalbox 8.0 #40

Closed edthedev closed 2 years ago

edthedev commented 2 years ago

Benefits of Ansible:

edthedev commented 2 years ago

It might be better to make the Ansible it's own separate repository, publish it to Ansible Galaxy, and then just link to it in the readme.

If I find time to build that, I'll submit a separate pull request with that update.

Vegz78 commented 2 years ago

Thanks for your contribution!

It might be better to make the Ansible it's own separate repository, publish it to Ansible Galaxy, and then just link to it in the readme.

Since this is your brainchild, you should decide what is best. Personally, either way, I imagine that this would be a welcomed contribution anyhow, maybe especially for those in a classroom/educational sitiation etc. with multiple (arcade) machines. Perhaps Ansible playbooks gives a clean uninstall/roll-back functionality as well, which still is missing from this repo?

Having no experience with Ansible myself, but after a quick look through your code, I have the following questions:

  1. Won't this proposed deletion of the final entry in the _systemlist.xml_MakeCodeRB render my other installation scripts dysfunctional?: https://github.com/Vegz78/McAirpos/pull/40/files#diff-f2e0a240b0100289489dbc6b188a534f823f8ff4dc43765f3ae8fffe5144e4d0L11

  2. What happened to the section regarding alsamixer which I reckon I saw earlier inside _ansibleinstall.yml? Does your solution work coherently with jack only audio for both MCA and the rest of Recalbox, and HDMI audio only for both MCA and the rest of Recalbox?

  3. Is there some kind of WSL ARM emulator for x86/x64 Windows which actually runs MakeCode Arcade .elf files, or should this section about Windows be removed? I occasionally get support requests already from people who have gotten the impression that McAirpos with MCA games work on other systems than ARM running Linux. https://github.com/Vegz78/McAirpos/pull/40/files#diff-fac2c4b2da0d1130d0f929abfff14008a96373c769abad4fdd1c8ee2ffca5226R7

edthedev commented 2 years ago
  1. yes, I think that's still an issue. Ansible needs the file content to add to be exact, so we will need to adjust the other scripts before merging if they're counting on the final closing tag. Even if we put this recipe into a separate repository, removing the extra tag would still be needed for Ansible compatibility.

UPDATE @Vegz78 I pushed an additional commit which should fix this issue, by adding the additional closing tag back in the two shell scripts that delete it.

edthedev commented 2 years ago
  1. I didn't end up needing Alsamixer for RecalBox 8.1. My arcade machines both use the audio jack on the Raspberry Pi, and Alsa Mixer wasn't in the recipe for RecalBox that I needed the Ansible playbook on.

I would be delighted to collaborate to expand the Ansible recipe to support RetroPi and HDMI on Recalbox, but I'll need a collaborator to help with final testing.

edthedev commented 2 years ago
  1. The comment about WSL is just for getting Anible running under Windows. It answers a question I see a lot from new Anible users.
edthedev commented 2 years ago

I plan to work on an Ansible Galaxy collection or role for this, but I'm inclined to work first toward ironing out the missing closing tag issue on the current version, since that prevents merging the work to date.

edthedev commented 2 years ago

@Vegz78 Is there any context where the additional steps for HDMI in install_recalbox_v8.0_HDMI-Audio-Fix.sh cause problems? If not, I could update the Ansible playbook to always include them.

https://github.com/Vegz78/McAirpos/blob/2aabb5a6aca1c4f01f11af3a6be36e23a841f526/install_recalbox_v8.0_HDMI-Audio-Fix.sh#L69-L73

Vegz78 commented 2 years ago

Hi @edthedev,

I am reviewing and testing your PR locally now. I'll report back soon.

@Vegz78 Is there any context where the additional steps for HDMI in install_recalbox_v8.0_HDMI-Audio-Fix.sh cause problems? If not, I could update the Ansible playbook to always include them.

But when I think about your question here, I am already pretty certain that my installation with the HDMI fix locks audio via the HDMI device on hw:0,0, which MCA games then always uses, and that the script without the fix locks audio likewise via jack on hw:0,0. One would therefore, if both audio devices are present, be forced to disable the HDMI audio device completely to force audio via jack if the HDMI fix is always included.

Could an option be to have two different Ansible playbooks as well, with and without HDMI fix, respectively, or do you have a better idea?

Vegz78 commented 2 years ago

I have now reviewed and merged your contributions, which now are tested to run well with the following edits:

  1. Fixed small bug with cat instead of echo for <\/SystemList> in my two original Recalbox 8 installation scripts.
  2. Added a 2nd Ansible playbook for the HDMI fix.
  3. Removed the Fully Qualified Collection names so that the playbooks would work on older Ansible installations, like my own.
  4. Added compression into a single archive of the McAirpos folders which is copied by Ansible to the remote systems, since copying of many files and subfolders is known and experienced to be very slow when using the Ansible copy module; https://stackoverflow.com/q/27985334/12802435. (Since I use tar -czf as a shell command locally on the host, I assume the playbooks no longer will work from windows hosts. But the archive module had too many requirements for different zip packages to be useful on Recalbox clients and, being new to Ansible, I did not find a better way. Maybe you could improve on this?)

Initially, I wanted to commit my changes to your pull request here, and then review and merge everything via the GitHub web interface together with you, and so that you would appear as another contributor on the McAirpos repo front page. However, also being new to git terminal commands, I made a blunder and merged everything directly to the master branch instead, and your name unfortunately does not show up on the repo main page as a contributor, only inside the commit itself. Sorry about that! ;-)

(Update 2022.06.02: Maybe another reason for you user not appearing on the repo main page as a contributor could be that when you commit directly from your developer machine, your commits are not verified with a working link for your username, like @rdmueller's commits are here, for instance? I have the same situation on my developer machine, where - for some unknown reason - my commits made from home appear without verification and active username links, while my commits made online at GitHub are both verified and with an active link for my username.)

Please feel free to make another pull request, maybe improving the new and faster zip and copy operation in the Ansible playbooks, so that they also will work from Windows hosts and you will appear as an official contributor after I merge...

Thanks for all your efforts so far, @edthedev!