utils.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. export const getSubkeyContainers = (validators: number, dataPath: string) => {
  2. const result = []
  3. for (let i = 1; i <= validators; i++) {
  4. result.push({
  5. name: `subkey-node-${i}`,
  6. image: 'parity/subkey:latest',
  7. command: ['/bin/sh', '-c'],
  8. args: [`subkey generate-node-key >> ${dataPath}/privatekey${i} 2>> ${dataPath}/publickey${i}`],
  9. volumeMounts: [
  10. {
  11. name: 'subkey-data',
  12. mountPath: dataPath,
  13. },
  14. ],
  15. })
  16. }
  17. return result
  18. }
  19. export const getValidatorContainers = (
  20. validators: number,
  21. dataPath: string,
  22. builderPath: string,
  23. chainSpecPath: string
  24. ) => {
  25. const result = []
  26. for (let i = 1; i <= validators; i++) {
  27. result.push({
  28. name: `joystream-node-${i}`,
  29. image: 'joystream/node:latest',
  30. args: [
  31. '--chain',
  32. chainSpecPath,
  33. '--pruning',
  34. 'archive',
  35. '--node-key-file',
  36. `${dataPath}/privatekey${i}`,
  37. '--keystore-path',
  38. `${builderPath}/data/auth-${i - 1}`,
  39. '--validator',
  40. '--log',
  41. 'runtime,txpool,transaction-pool,trace=sync',
  42. ],
  43. volumeMounts: [
  44. {
  45. name: 'subkey-data',
  46. mountPath: dataPath,
  47. },
  48. {
  49. name: 'builder-data',
  50. mountPath: builderPath,
  51. },
  52. ],
  53. })
  54. }
  55. return result
  56. }