Post

Im Open-Sourcing Stuff Everybody Can Use It For Free But I Dont Want That Big Companies Can Use It As Well Perfectly Fine If Smes Use It Which License Should I Choose

Welcome to this comprehensive guide on how to license your open-source projects so they can be used freely by small and medium enterprises (SMEs), while restricting large corporations from utilizing.

# Open-Sourcing Your Homelab Infrastructure: Self-Hosted, Yet Exclusive for SMEs

Welcome to this comprehensive guide on how to license your open-source projects so they can be used freely by small and medium enterprises (SMEs), while restricting large corporations from utilizing them. We’ll walk through the process of setting up the infrastructure and choosing an appropriate license.

Prerequisites

  • A Debian-based Linux distribution (e.g., Ubuntu 20.04 LTS)
  • Docker version 5.0.8 or higher installed
  • Git for managing your open-source project

Step 1: Create a New Repository and Initial Commit

1
2
3
4
$ mkdir my_project && cd my_project
$ git init
$ git add .
$ git commit -m "Initial commit"

Step 2: Write Your Code and Documentation

Here is an example of a simple application in the app/ directory.

1
2
3
4
app/
|-- Dockerfile
|-- app.py
|-- requirements.txt

Inside each file, you can write your code as needed. For instance, the Dockerfile might look like this:

1
2
3
4
5
6
FROM python:3.8-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY app.py .
CMD ["python", "app.py"]

Step 3: Choose an Appropriate License

The license you choose will determine how your project can be used and distributed. For our purposes, the MIT License (MIT) is a suitable option that allows SMEs to use your project while restricting large corporations from doing so.

Add the MIT License as a file called LICENSE in the root of your repository:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
MIT License

Copyright (c) [year] [your name]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Step 4: Create a Dockerfile for the License Server

In this example, we’ll create a Docker image that hosts your license file and serves it as needed.

1
2
FROM nginx:latest
COPY LICENSE /usr/share/nginx/html/license.txt

Step 5: Build the License Server Image

Build the license server image using the following command:

1
$ docker build -t my-license-server .

Step 6: Run the License Server

Start a container from your newly built license server image:

1
$ docker run -d --name my-license-server -p 80:80 my-license-server

Now, you can access your licensed project at http://localhost.

Troubleshooting

If the license is not being served correctly, ensure that you’ve properly built and started the license server container. Verify the output of the docker ps command to confirm that the container is running.

Conclusion

By following these steps, you’ve created an open-source project that caters to SMEs while excluding large corporations. This approach can help maintain a level playing field in your industry and foster collaboration within the community. Happy coding!

Back to top

This post is licensed under CC BY 4.0 by the author.