Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I customize port and service name for couchdb during silent installation in Windows #5023

Open
Nidhi-Patel20 opened this issue Apr 2, 2024 · 6 comments
Assignees

Comments

@Nidhi-Patel20
Copy link

Nidhi-Patel20 commented Apr 2, 2024

Hey there, I am looking for a solution either for method-1 or method-2.

For my enterprise software I need Couchdb to be packaged in it and install it with following specifications.
service name : Apache-COUCHDB-3.3.3
ports :
chttpd = 5984
httpd = 5986
ssl = 6984

Till now I was using CouchDB-2.1.0 packaging (same directory structure as when msi is installed and the above ports were made configurable) and install it using windows cmd.

> C:/CouchDB-2.1.0/bin/nssm.exe install service-name C:/CouchDB-2.1.0/bin/couchdb.cmd C:/CouchDB-2.1.0/bin SERVICE_AUTO_START
> sc start service-name

Method-1

As I want to use upgraded couchdb version for my enterprise software I downloaded the apache-couchdb-3.3.3-2.msi from its official site and installed the Apache Couchdb. But as I need the package and then customize it as mentioned above, I zipped the installed directory folder and then extracted it to a different folder. Also, I uninstalled the previously installed service. I used the same commands as mentioned above and tried to install the service. Although the service got installed but it never starts and just remains in paused state. I tried to identify the root cause but couldn't find any specific. Even logs are not getting generated at C:/CouchDB-3.3.3/var/log/couchdb.log. But I observed a new file at C:/CouchDB-3.3.3/erl-cash.dump was generated and it had following in it -

=erl_crash_dump:0.5
Mon Apr 1 19:15:56 2024
Slogan: could not start kernel pid (application_controller) (error in config file "C:/CouchDB-3.3.3/bin.config" (none): configuration file not found)
System version: Erlang/OTP 24 [erts-12.3.2.14] [source] [64-bit] [smp:12:12] [ds:12:12:16] [async-threads:1] [jit]
Taints:
Atoms: 5805
Calling Thread: scheduler:6

Same thing when I tried with CouchDB-2.1.0, it worked. Service was installed and it was running fine with proper logs.

Method-2

I used apache-couchdb-3.3.3-2.msi and performed silent installation using the below cmd provided in couchdb documentation.

msiexec /i C:/apache-couchdb-3.3.3-2.msi /quiet INSTALLSERVICE=1 ADMINUSER=abc ADMINPASSWORD=pass@123 /norestart

The service got installed and running fine. But I couldn't find a way to customize ports and services at the time of installation.

Could you please help me out with this?

@big-r81
Copy link
Contributor

big-r81 commented Apr 4, 2024

Hey @Nidhi-Patel20,

I tried to reproduce your issues, with no luck. All is working for me.

At the moment, there is no way to configure your ports during (silent) installation! This needs to be implemented.

Next, try to start CouchDB from a normal command prompt for example with (install dir C:\CouchDB-3.3.3):

C:\>CouchDB-3.3.3\bin\couchdb.cmd

This should start CouchDB (and there should be no output).
If you get a crash report, please append the message here!
Before we proceed, give this a try and show your findings.

Cheers, Ronny

@siddheshmalpani
Copy link

siddheshmalpani commented Apr 10, 2024

Hey Ronny,

Nidhi works with me, so I know her use case and let explain that to you.

Ours is a desktop based enterprise application for Windows. The application has a mobile app which uses CouchDB. The entire product is shipped in the form on an installer (.exe). The executable takes care of installing Tomcat, ActiveMQ, MariaDB and CouchDB as Windows services.

CouchDB v2.1.0:
Till now we have been using this version. The way we packaged it with our installer is:

  • Install CouchDB using msi installer. Stop the services and zip the installation directory. This was just one time activity.
  • Use the zip in all the enterprise installer bundling.
  • When the installer is run, identify the open ports and use them in the config properties and run the commands like following to install the CouchDB service -
> C:/NS/Production/Mobile/CouchDB/bin/nssm.exe install NS-COUCHDB-5985 C:/NS/Production/Mobile/CouchDB/bin/couchdb.cmd C:/NS/Production/Mobile/CouchDB/bin SERVICE_AUTO_START
> sc start NS-COUCHDB-5985

CouchDB v3.3.3:
We're now upgrading to this version of CouchDB. We tried using the above steps. The service gets installed, but it doesn't start up. So this doesn't work anymore for us.
Next we tried the silent installation. This installs the CouchDB but we're now not in control to identify and specify the ports beforehand and customize the service name.

Controlling the ports and service name before installation is important to us, because if we don't follow this and there's any deviation in the port consumption or service name, our customers won't be happy.
So, with v3.3.3, is there any workaround with which we can achieve this?

Thanks in advance!

Regards,
Siddhesh Malpani

@big-r81
Copy link
Contributor

big-r81 commented Apr 10, 2024

Hi Siddhesh,

CouchDB v3.3.3: We're now upgrading to this version of CouchDB. We tried using the above steps. The service gets installed, but it doesn't start up. So this doesn't work anymore for us. Next we tried the silent installation. This installs the CouchDB but we're now not in control to identify and specify the ports beforehand and customize the service name.

Controlling the ports and service name before installation is important to us, because if we don't follow this and there's any deviation in the port consumption or service name, our customers won't be happy. So, with v3.3.3, is there any workaround with which we can achieve this?

thanks, understood! But if we go further, please do the steps I mentioned above:

Next, try to start CouchDB from a normal command prompt for example with (install dir C:\CouchDB-3.3.3):

C:>CouchDB-3.3.3\bin\couchdb.cmd

This should start CouchDB (and there should be no output in the command prompt).
If you get a crash report, please append the message here!
Before we proceed, give this a try and show your findings.

With this steps, I want to see if you can run CouchDB as a normal user.

@siddheshmalpani
Copy link

siddheshmalpani commented Apr 16, 2024

Hi Ronny,

As suggested by you, by running C:>CouchDB-3.3.3\bin\couchdb.cmd we could run the CouchDB and it didn't not generate any crash dump.
However, if we create a service out of it and try to run, it fails to start and generates a crash dump. PFA, I hope it helps.

erl_crash.zip

Regards,
Siddhesh Malpani

@siddheshmalpani
Copy link

Hi Ronny,

Did you get a chance to look at the crash dump?

Regards,
Siddhesh Malpani

@big-r81
Copy link
Contributor

big-r81 commented Apr 18, 2024

Hi,

mhh, I can't reproduce this!

I did this steps to install CouchDB (without the automatic service installation):

Silenty install CouchDB to C:\CouchDB-Test:

msiexec /i apache-couchdb-3.3.3.msi /quiet APPLICATIONFOLDER=C:\CouchDB-Test ADMINUSER=a ADMINPASSWORD=a /norestart

Afterwards CouchDB should be installed into C:\CouchDB-Test.

Now you can manually install the service with (you need admin rights):

C:\CouchDB-Test\bin\nssm.exe install "Apache CouchDB Test" "C:\CouchDB-Test\bin\couchdb.cmd"
Service "Apache CouchDB Test" installed successfully!

Now you can check the installation and the status of the service (should be stopped):

C:\CouchDB-Test\bin\nssm.exe status "Apache CouchDB Test"
SERVICE_STOPPED

The service should start with:

C:\CouchDB-Test\bin\nssm.exe start "Apache CouchDB Test"
Apache CouchDB Test: START: Der Vorgang wurde erfolgreich beendet. (<-- translating: starting was successful)

C:\CouchDB-Test\bin\nssm.exe status "Apache CouchDB Test"
SERVICE_RUNNING

Testing:

curl.exe http://127.0.0.1:5984/_up
{"status":"ok","seeds":{}}

So the crash dump doesn't show me anything interesting. Do you have any logs while starting the service?
Important is, that the install directory of CouchDB needs admin rights, so your (service) user needs that too,
or you have to change this permissions of the install dir after the installation!

Only informational if you want to install the service as well do:

msiexec /i apache-couchdb-3.3.3.msi /quiet INSTALLSERVICE=1 APPLICATIONFOLDER=C:\CouchDB-Test ADMINUSER=a ADMINPASSWORD=a /norestart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants