Developing a Litium 8 site on macOS

Hi there!
I’m trying to set up a developer environment for Litium 8 on macOS.

I’ve gotten so far so far so that .NET complains about that it can’t connect to the SQL-server running in docker.
I’ve also got some problems generating a certificate as explained in the github-repo, which is probably why the apps(payment and delivery) isn’t starting.

Maybe someone else is trying to accomplish the same or you guys at Litium knows how to set it up correctly?

I thought I’d share the steps I’ve figured out so far, if someone else want to give it a go.
That will probably save you some time.

  1. System requirements:
    Install .NET 5 sdk:
    Download .NET 5.0 (Linux, macOS, and Windows)

Then install the rest of the requirements as stated here: System requirements

2. Configure nuget
As explained here: Litium packages

You might get this error:
error: Password encryption is not supported on .NET Core for this platform. The following feed try to use an encrypted password: ‘Litium’. You can use a clear text password as a workaround.
error: Encryption is not supported on non-Windows platforms.

Solved by storing passwords in clear text. (?! What could go wrong?) Like this:
dotnet nuget add source https://nuget.litium.com/nuget/ -n Litium -u -p --store-password-in-clear-text

3 Installing docker:

and do this:
docker login registry.litium.cloud -u username

4. The dev cert
Install powershell as a global tool, that way we can use the same syntax as here: Education/Developer Education/Tasks/Developer certificate at main · LitiumAB/Education · GitHub

However on number 5. i get an error telling me that i havent got a valid .pfx-file. (Now what? i have no idea yet. maybe someone knows what to do?)

To temporarily get passed this step, and being able to continue i just generated a dev cert and went along with it like this:

dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p “123456”
dotnet dev-certs https --trust

5. The docker task
Do this task:

6. The installation task
start here Education/Developer Education/Tasks/Installation at main · LitiumAB/Education · GitHub
install the template

dotnet new --install “Litium.Accelerator.Templates”

create a new dir to install new accelerator
run dotnet new litmvcacc in that dir from the terminal

7.Edit host file
Since macOS doesnt have the localtest.me feature that Windows has I did add a bookstore.localtest.me to the host file and hoping for the best.
(How to Find the Hosts File on my Mac - Nexcess)

8. Start the site
navigate to you Litium.Accelerator.Mvc project in a terminal and type:
dotnet watch run
The site appears to start, but i get an error message that i can’t connect to the database.

Litium version: 8.1

How did you install the database in step 6? Is there any issue? Since you don’t mention.

I am running Mac M1 and last time I tried, the only SQL image that supports M1 chips is the Azure Sql image, so you might want to try that one, or connect to a SQL instance from another machine.

I followed the docker task on Github to install it. I’m trying to “translate” those docs into something that works for macOS as well. This is the task: Education/Developer Education/Tasks/Docker at main · LitiumAB/Education · GitHub and these are the containers that gets installed, where sqlserver:2019-latest is referenced: Education/docker-compose.yaml at main · LitiumAB/Education · GitHub
I did not run into any issue when installing the sql-container.

I’m not running on a M1-mac, but I could try the azure-container anyways.

It sounds like you have a Litium 8 site up and running on you mac?

Yes I got it up and running.

Where do you config the connection string? In appSettings or in App secrets? Also check the Sql instance to make sure it starts without any problem.

We have been trying the same thing and get the same result as. Would love to know if you got it to work yet @Christian.Engvall

I got L8 Beta running on mac with Intel i7 in the summer.

1 Like

I finally got Litium up and running on macOS.

I think I found the reason behind the database not working. After looking at my Windows installation I saw that Docker Desktop adds three lines automatically to the hosts file which are:

{your machine ip} host.docker.internal
{your machine ip} gateway.docker.internal
127.0.0.1 kubernetes.docker.internal

Looking at my hosts file in macOS there is only one line added by docker and that is:

127.0.0.1 kubernetes.docker.internal

It is the above host name that is used when running litium db-tool hence it works when connecting. But for the ConnectionString in the MVC project the host name used is host.docker.internal which is not present. So by adding it to the hosts file I got it working. You could also use 127.0.0.1 directly in your appsettings I guess.

I also had problem with with setting up a valid dev certificate for *.localtest.me so I ended up using localhost as DNS in my certificate instead and then it worked. I’m sure it is possible to setup a certificate for *.localtest.me if you know what you’re doing. :smiley:

Hope this made sense and helped!

2 Likes

Cool, thanks for sharing. I’ve had a few weeks off but i’ll try it out when I get the chance!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.