Compare commits
	
		
			No commits in common. "main" and "v0.0.1" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							| @ -41,10 +41,8 @@ By setting `$BASE_DIR` you can persist the database for later runs. | |||||||
| 
 | 
 | ||||||
| ## TODO | ## TODO | ||||||
| 
 | 
 | ||||||
| - [x] CI | - CI | ||||||
| - [x] Docker container (in flake) | - Docker container (in flake) | ||||||
| - [x] try fourmolu | - try fourmolu | ||||||
| - [x] Test leap second handling in the `time` package | - Test leap second handling in the `time` package | ||||||
| - [ ] Fix container shutdown delay | - use queue to sync logging of indexer and main thread | ||||||
| - [ ] Fix `responseFile` always returning 200 |  | ||||||
| - [ ] use queue to sync logging of indexer and main thread |  | ||||||
|  | |||||||
| @ -65,7 +65,6 @@ import Data.Time.Clock.POSIX (getPOSIXTime) | |||||||
| import qualified Envy | import qualified Envy | ||||||
| import qualified Yore.DB as DB | import qualified Yore.DB as DB | ||||||
| import qualified Yore.Log as Log | import qualified Yore.Log as Log | ||||||
| import System.IO (hSetBuffering, BufferMode (..), stdout) |  | ||||||
| 
 | 
 | ||||||
| data ConfigT f = Config | data ConfigT f = Config | ||||||
|   { yorePort :: f =@@ Int ? 3000 |   { yorePort :: f =@@ Int ? 3000 | ||||||
| @ -80,8 +79,6 @@ deriving instance Show Config | |||||||
| 
 | 
 | ||||||
| main :: IO () | main :: IO () | ||||||
| main = do | main = do | ||||||
|   hSetBuffering stdout NoBuffering |  | ||||||
| 
 |  | ||||||
|   cfg <- |   cfg <- | ||||||
|     Envy.load @ConfigT >>= \case |     Envy.load @ConfigT >>= \case | ||||||
|       Left errs -> do |       Left errs -> do | ||||||
|  | |||||||
							
								
								
									
										46
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								flake.nix
									
									
									
									
									
								
							| @ -58,48 +58,22 @@ | |||||||
|             # Return only the bin folder to curb image size |             # Return only the bin folder to curb image size | ||||||
|             compose.justStaticExecutables |             compose.justStaticExecutables | ||||||
|           ]; |           ]; | ||||||
|  |       in { | ||||||
|  |         packages = rec { | ||||||
|  |           default = yore; | ||||||
|  |           inherit yore; | ||||||
|  |           yore-meta = pkgs.runCommand "yore-meta" {} '' | ||||||
|  |             mkdir -p $out | ||||||
|  |             echo -n ${yore.version} > $out/version | ||||||
|  |             echo -n git.pbrinkmeier.de/paul/yore:${yore.version} > $out/image-tag | ||||||
|  |           ''; | ||||||
| 
 | 
 | ||||||
|           image = |           image = | ||||||
|             pkgs.dockerTools.buildImage { |             pkgs.dockerTools.buildImage { | ||||||
|               name = "git.pbrinkmeier.de/paul/yore"; |               name = "git.pbrinkmeier.de/paul/yore"; | ||||||
|               tag = yore.version; |               tag = yore.version; | ||||||
|             copyToRoot = [ pkgs.cacert ]; |               config.Cmd = [ "${yore}/bin/yore" ]; | ||||||
|             config = { |  | ||||||
|               Cmd = [ "${entrypoint}/bin/run" ]; |  | ||||||
|               StopSignal = "SIGINT"; |  | ||||||
|             }; |             }; | ||||||
|           }; |  | ||||||
| 
 |  | ||||||
|         entrypoint = pkgs.writeShellApplication { |  | ||||||
|           name = "run"; |  | ||||||
|           runtimeInputs = [ pkgs.coreutils pkgs.dbmate yore ]; |  | ||||||
|           text = '' |  | ||||||
|             set -Eeuo pipefail |  | ||||||
| 
 |  | ||||||
|             mkdir -p "''${YORE_DBMATE_DIR}" |  | ||||||
|             TMPDIR=$(mktemp -dp "''${YORE_DBMATE_DIR}") |  | ||||||
|             mkdir -p "''${TMPDIR}/db" |  | ||||||
|             cp -r ${./db}/* "''${TMPDIR}/db" |  | ||||||
|             cd "''${TMPDIR}" |  | ||||||
|             dbmate up |  | ||||||
|             chmod +w -R "''${TMPDIR}" |  | ||||||
|             rm -rf "''${TMPDIR}" |  | ||||||
| 
 |  | ||||||
|             # Replace bash and inherit PID 1 |  | ||||||
|             cd / |  | ||||||
|             exec yore |  | ||||||
|           ''; |  | ||||||
|         }; |  | ||||||
|       in { |  | ||||||
|         packages = rec { |  | ||||||
|           default = yore; |  | ||||||
|           inherit yore image; |  | ||||||
|           yore-meta = pkgs.runCommand "yore-meta" {} '' |  | ||||||
|             mkdir -p $out |  | ||||||
|             echo -n ${yore.version} > $out/version |  | ||||||
|             echo -n ${image.drvAttrs.imageName}:${image.drvAttrs.imageTag} > $out/image-tag |  | ||||||
|           ''; |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
|           opium_ = opium.packages.${system}.opium; |           opium_ = opium.packages.${system}.opium; | ||||||
|         }; |         }; | ||||||
|  | |||||||
| @ -112,7 +112,7 @@ showpdfRequest (y, m, d) = | |||||||
|     NoReqBody |     NoReqBody | ||||||
|     bsResponse |     bsResponse | ||||||
|     ( formToQuery |     ( formToQuery | ||||||
|         [ ("cmd" :: Text, "showpdfjs") |         [ ("cmd" :: Text, "showpdf") | ||||||
|         , ("year", y) |         , ("year", y) | ||||||
|         , ("month", m) |         , ("month", m) | ||||||
|         , ("day", d) |         , ("day", d) | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| cabal-version: 3.4 | cabal-version: 3.4 | ||||||
| 
 | 
 | ||||||
| name:           yore | name:           yore | ||||||
| version:        0.0.9 | version:        0.0.1 | ||||||
| author:         Paul Brinkmeier | author:         Paul Brinkmeier | ||||||
| maintainer:     hallo@pbrinkmeier.de | maintainer:     hallo@pbrinkmeier.de | ||||||
| copyright:      2023 Paul Brinkmeier | copyright:      2023 Paul Brinkmeier | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user