Firebird database development

I messed up again. I modified the files in the repo, but I couldn’t create the Firebird port opening and closing configuration window. As a result of the modifications, only the following screen appears when I load the Firebird Settings:

1 Like

You could build the UI online, so you can see changes to the UI immediately and it’s also easier to catch errors, see also How to build your UI online while you are coding

@mrmarkuz Thank you for opening a new topic for me.

Unfortunately, the problem cannot be solved.

I don’t understand this description. I have a problem interpreting it right from the start. I have no idea what kind of server they are talking about and why you need to open two terminals… I don’t understand rsync either. Where do you want to synchronize from? From the local machine to the server? Where should the vscode project be created? Where will Visual Studio be installed and on what machine? I don’t understand…

You could use the browser console to find UI errors, see also this article.

A NethServer 8.

In both terminals the commands need to be run in the ui dir of your NS8 project, for example ~/code/ns8-firebird/ui.

One terminal builds the UI and watches if there are changes to rebuild it. In this terminal you will also see build errors that can help you to find what you need to change in your code.

The other terminal syncs the UI to the NS8 so that after refreshing your browser you can see your changes immediately.

Yes, the UI code is synced from your dev machine (where you git cloned the code and are editing it) to an NS8 where the app that you’re working on is installed so you can browse to the UI of the app and check if it works and looks nice.

If you’re using vscode it’s usually installed on your dev machine but it’s not required. You can use any editor as you like.

Unfortunately, I still don’t understand how to install and use this “development environment”. I’m sure I’m the cause of the problem, but I just don’t understand it…

Is there any precise detailed description about it? But please don’t recommend the Developer pages, because they are also incomprehensible to me…

I messed something up. I tried to restore the firewall port opening/closing state before the modification but it didn’t work, same error and screen. I can’t restore the last working state, even though I deleted it and restored all files to their previous working state. I cleared the Firefox cache, restarted the Firebird app, then the entire NS8 but it didn’t work.

Maybe this presentation helps a bit?

1 Like

@LayLow I’ve seen this about half a dozen times. I understand the theory, but the practice is incomprehensible. It doesn’t help you understand the UI development steps, the procedures, the process.

Usually there’s nothing to install, just use the two terminals to build and sync the UI from your development workstation to the NS8 where firebird is installed.

I’m sorry but I need to share the link to the development documentation where the process is explained in other words.

Could you please point out what’s not clear so I can try to provide another explanation. Maybe we can improve the documentation to make it easier for future devs.

Please follow the links to get information about the UI development:

Modules use Vue Router to implement page routing and Vuex to handle global state.

Source: Modules UI | NS8 dev manual

In the meanwhile I’ll have a look what happened and try to fix it.

EDIT:

You restored the previous state but the validate-input.json and validate-output.json contained a wrong comma.

At the last element "tz", the comma is not allowed in JSON, it should be "tz" without the comma. It’s confusing as for example in JavaScript it’s allowed.
Another explanation is that the comma in JSON is a delimiter and not a terminator.

  "required": [
    "charset",
    "port",
    "tz",
  ],

I recommend to check the json files using jq as it outputs the error:

[firebird3@node state]$ cat ../actions/get-configuration/validate-output.json | jq
parse error: Expected another array element at line 18, column 5

See Trailing commas - JavaScript | MDN for more info.

I’m going to check the work you’ve already done to implement “opening/closing the firewall port”.

Thank you very much. In the meantime, I compared the local ns8-firebird backup directory with diff and it immediately showed me where I made a mistake. It was exactly the problem you found. Thank you.

I fixed it and now the world is back to normal, Firebird is working again.

My question is that for some reason the same line appears twice in build-images.sh, is this necessary or did something go wrong?

buildah config --entrypoint=/
–label=“org.nethserver.authorizations=traefik@node:routeadm node:fwadm”
–label=“org.nethserver.tcp-ports-demand=0”
–label=“org.nethserver.rootfull=0”
–label=“``org.nethserver.images=docker.io/firebirdsql/firebird:3.0.11”``
–label=“org.nethserver.authorizations=traefik@node:routeadm node:fwadm”
“${container}”

Should I delete one of the lines –label=“org.nethserver.authorizations=traefik@node:routeadm node:fwadm” and if so, which one do you think is appropriate?

In the meantime, I tried to install the Firebird 2.5.9 server, because I needed it as a second Firebird, and I was successful. I only tried it under scratchpad, but it seemed to work and I was able to connect to it with telnet. In this regard, I would like to ask whether the Firebird module is currently named ns8-firebird, but can it be renamed to, for example, ns8-firebird3011, so that the other Firebird module is named ns8-firebird259-ss. I remember that there are only a limited number of names that can be given to modules, but it would be good to distinguish between the two. Do you have any suggestions for that?

Now that I’ve managed to get Firebird working again, I’ll try to improve the UI…

1 Like

No, you can remove one of the lines. In the templates the first line is used but both should work, see Images | NS8 dev manual

It can be renamed but there must not be a digit at the end.

I never tested but what about adding a dropdown field to the UI to select a firebird version? The configure-module action could change the FIREBIRD_IMAGE variable so after a restart of the services the new image is used. This way you can keep the name of the firebird app.

1 Like

This seems like a great idea. I hope my version will work with the same settings, but then I’ll need to make additional Firebird version-dependent settings.

If I can get the firewall setup working, it might be worth trying that too.

1 Like

If I understand correctly, I need to install yarn and yarn watch on the server where Firebird is currently running?

I can’t find such a directory in the /home/firebird5 directory of the NS8 server. I can find the /home/firebird/.local/share/containers/storage/overlay/…/diff/ui directories, but there are about 33 of them. If I find it, do I need to install yarn & yarn watch as root or do I need to log into the container as the firebird5 user and install it that way?

What they shared about the development is that VS Code is used, where should this be installed on NS8 or on the machine I’m running the terminal on? How to use VS Code?

No, you need to install yarn on your dev workstation where you are editing the files that you cloned from Github.

VSCode should be installed on your dev workstation where also the terminals are running.

Just download and install, there should be a lot of tutorials.

If I understand correctly, you need to go to the ui directory of the module source code downloaded from Github on the developer workstation and install yarn that way. Is this correct?

1 Like

Yes, that’s right.

@mrmarkuz Thank you. Before I started installing the UI development environment, I did a quick experiment with manual editing.

I managed to insert the Open/close Firebird Firewall port button into the UI, which apparently works, changes state, but unfortunately does not block the firewall port.

I think the firewall control is not working, could you take a look at what the problem could be? I’ll pull myself together and try to install the UI development environment, because if I want an optional Firebird image, I need to install it.

Thank you for your help

1 Like

I opened a Pull request.

Thank you very much @mrmarkuz I was hoping you would find where I went wrong… :frowning:

Your fix works, but there is a small problem: when it says Enabled, the Firebird port is disabled on the firewall, and when it says disabled, it is enabled. I think you need to change the TRUE and FALSE values. :frowning: Or do I need to change the button caption?

The good news is that it works the same even if I change the port.

I still have to test tomorrow whether the Firebird port is accessible via VPN if it is blocked on the firewall…

You could change the if with the else block to make it work the other way round:

if ff:
  agent.add_public_service(os.environ['MODULE_ID'], [
    os.environ['FIREBIRD_PORT']+"/tcp", # Firebird port
  ], replace_ports=True)
else:
  agent.remove_public_service(os.environ['MODULE_ID'])

or use if not ff, see Python IF with NOT Operator - GeeksforGeeks

You were too fast, I couldn’t even check the settings. Unfortunately, this did not reverse the setting.

This is what the Settings page looks like when the Firebird port is enabled (opened) on the firewall, this state is indicated by the Disabled label and the disabled button. When the Firebird port is disabled (closed) on the firewall, the Enabled label and the enabled button indicate the state. Maybe the labels should be changed to Enabled - Close, Disabled - Open?

I’m afraid this won’t change the situation either… I’ll check it out too.

In the meantime, thank you for your help.