aquarist-labs / aquarium

Project Aquarium is a SUSE-sponsored open source project aiming at becoming an easy to use, rock solid storage appliance based on Ceph.
https://aquarist-labs.io/
Other
71 stars 23 forks source link

SSL Support #759

Closed jhesketh closed 1 year ago

jhesketh commented 2 years ago

This won't work due to the large patchset that just merged. I'll rebase this shortly but looking for first feedback.

github-actions[bot] commented 2 years ago

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

jhesketh commented 2 years ago

This has been reworked with the latest large refactor(s).

You can set an SSL cert by POST'ing to /api/local/ssl a json blob such as

{
  "use_ssl": true,
  "key_contents": "XYZ",
  "cert_contents": "ABC"
}

Obviously future improvements will be to auto-generate self-signed or allow lets-encrypt etc.

votdev commented 2 years ago

Found a bug when the node is not deployed and shutdown is forced.

node1:/srv/aquarium # ./tools/run_aquarium.sh --debug
INFO:     2022-01-18 07:32:25 -- aquarium -- Aquarium startup!
DEBUG:    2022-01-18 07:32:25 -- config -- Aquarium config dir: /etc/aquarium
DEBUG:    2022-01-18 07:32:25 -- selector_events -- Using selector: EpollSelector
DEBUG:    2022-01-18 07:32:25 -- aquarium -- Starting main Aquarium task.
DEBUG:    2022-01-18 07:32:25 -- mgr -- Starting main task.
DEBUG:    2022-01-18 07:32:25 -- mgr -- Checking deployment state
DEBUG:    2022-01-18 07:32:25 -- utils -- run ['lvm', 'lvs', '--noheadings', '-o', 'vg_name,lv_name', '@aquarium']: retcode = 0
INFO:     2022-01-18 07:32:25 -- mgr -- System Disk not found, assuming fresh node.
DEBUG:    2022-01-18 07:32:25 -- kv -- Starting cluster connection thread
DEBUG:    2022-01-18 07:32:25 -- aquarium -- Starting uvicorn
DEBUG:    2022-01-18 07:32:25 -- aquarium -- Waiting for node to be installed.
INFO:     2022-01-18 07:32:25 -- kv -- Can't get cluster handle: '[errno 2] RADOS object not found (error calling conf_read_file)' - will keep retrying
DEBUG:    2022-01-18 07:32:25 -- kv -- Cluster connection thread sleeping for 10 seconds
INFO:     Started server process [3692]
INFO:     2022-01-18 07:32:25 -- server -- Started server process [3692]
INFO:     Waiting for application startup.
INFO:     2022-01-18 07:32:25 -- on -- Waiting for application startup.
INFO:     Application startup complete.
INFO:     2022-01-18 07:32:25 -- on -- Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
INFO:     2022-01-18 07:32:25 -- server -- Uvicorn running on http://0.0.0.0:80 (Press CTRL+C to quit)
^CDEBUG:    2022-01-18 07:32:26 -- mgr -- Checking deployment state
DEBUG:    2022-01-18 07:32:26 -- aquarium -- Stopping uvicorn
INFO:     Shutting down
INFO:     2022-01-18 07:32:26 -- server -- Shutting down
INFO:     Waiting for application shutdown.
INFO:     2022-01-18 07:32:26 -- on -- Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     2022-01-18 07:32:26 -- on -- Application shutdown complete.
INFO:     Finished server process [3692]
INFO:     2022-01-18 07:32:26 -- server -- Finished server process [3692]
INFO:     2022-01-18 07:32:26 -- aquarium -- Aquarium shutdown!
INFO:     2022-01-18 07:32:26 -- aquarium -- shutting down gstate
INFO:     2022-01-18 07:32:26 -- gstate -- shutdown!
DEBUG:    2022-01-18 07:32:26 -- kv -- Shutting down cluster connection
DEBUG:    2022-01-18 07:32:26 -- kv -- Cluster connection is shut down
Traceback (most recent call last):
  File "./aquarium.py", line 344, in <module>
    main()
  File "./aquarium.py", line 339, in main
    asyncio.run(aqr.run())
  File "/usr/lib64/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "./aquarium.py", line 180, in run
    await self.shutdown()
  File "./aquarium.py", line 285, in shutdown
    await self.gstate.shutdown()
  File "/srv/aquarium/src/gravel/controllers/gstate.py", line 201, in shutdown
    await self.tick_task
AttributeError: 'GlobalState' object has no attribute 'tick_task'

Can be fixed by:

--- a/src/gravel/controllers/gstate.py  (revision 3319080e55ea440a316c753aeac90408ab939522)
+++ b/src/gravel/controllers/gstate.py  (date 1642491153943)
@@ -198,7 +198,8 @@
         self._is_shutting_down = True
         await self._kvstore.close()
         logger.info("shutdown!")
-        await self.tick_task
+        if hasattr(self, 'tick_task'):
+            await self.tick_task

     async def tick(self) -> None:
         while not self._is_shutting_down:
jhesketh commented 2 years ago

@votdev good catches, thanks for that :+1: