3

Using F# on Ubuntu to develop SAFE Stack apps

 1 year ago
source link: https://www.compositional-it.com/news-blog/using-fsharp-on-ubuntu-to-develop-safe-stack-apps/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Since June 2022, Ubuntu has been the only operating system that I've used while working for Compositional IT.

In this post, I'll share some notes on how you can set up an Ubuntu environment for F# and SAFE Stack development. First off, I'll discuss why I use Ubuntu.

Why use Ubuntu at all

There are a variety of reasons why people might use Ubuntu. The main motivators for me are:

  • I support the principle of free and open source operating systems, and want to be part of the user base.
  • Ubuntu is the GNU/Linux operating system that I'm most familiar with.
  • I prefer installing system programs via package manager, and the number of non-package-managed programs is vastly smaller in Ubuntu than Windows.
  • I've been on a journey over the past few years to reduce my dependency on the mouse and increase my use of the keyboard. Linux apps tend to have keyboard users in mind more often than Windows apps, making keyboard use easier.
  • I feel slightly weirded out by the amount of data that Microsoft collects when I use Windows.
  • A solid understanding of Linux seems useful as more of the cloud moves to using it.

Dev environment setup

If you decide you want to use Ubuntu, the first thing you need to do is—of course—install it. The Ubuntu website has an installation tutorial. In the rest of this post, I'll assume that you have Ubuntu 22.04 installed.

Basics

SQL Server

If you're running a production web application, chances are you'll want a database. For a lot of people working in the .NET ecosystem, that usually means SQL Server. Here are some tips:

If you want to use SSDT database projects to version control your database schema (we do this at Compositional IT):

  • Change your database project(s) to use the SDK style, referring to the Microsoft.Build.Sql SDK.
  • Install the sqlpackage utility.
  • If you want to be able to deploy database changes via your FAKE build project, add a symlink from /usr/local/bin/sqlpackage (where FAKE currently expects sqlpackage to be) to your sqlpackage install location (which you can find using which sqlpackage in the terminal). For example, I ran

    sudo ln -s /home/matt/.dotnet/tools/sqlpackage /usr/local/bin/sqlpackage

    • Aside: before sqlpackage was available as a dotnet tool, I had some trouble using it when connecting to Docker containers ("an error occurred during the pre-login handshake"). As a workaround I would tweak my openssl configuration before deploying database changes, which was far from ideal. I no longer have to do this, but if you face an issue like this, feel free to reach out to me, for example via the F# Software Foundation Slack workspace.

Excel files

Some of our apps read in or generate Excel files. So far, using LibreOffice Calc (usually installed by default) has worked fine for me. That said, something like editing a carefully formatted template file would make me nervous, and might make me reach for a Windows VM (which I haven't done as yet).

If you use EPPlus, you'll need to install its dependency libgdiplus: sudo apt install libgdiplus.

If your team uses Microsoft Office for non-development activities, I've found the web versions to be sufficient.

Remote desktop

You may occasionally need to remote into a Windows machine, for example an Azure VM. I use Remmina for this: sudo apt install remmina remmina-plugin-vnc.

Conclusion

I'm really happy with my switch to Ubuntu, for the reasons above and more. If you're considering giving it a try for F# / SAFE Stack development, I hope that you are now confident that it's possible and that this post serves as a useful guide!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK