utils.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. ports: [{ containerPort: 9944 }, { containerPort: 9933 }],
  31. args: [
  32. '--chain',
  33. chainSpecPath,
  34. '--pruning',
  35. 'archive',
  36. '--node-key-file',
  37. `${dataPath}/privatekey${i}`,
  38. '--keystore-path',
  39. `${builderPath}/data/auth-${i - 1}`,
  40. '--validator',
  41. '--log',
  42. 'runtime,txpool,transaction-pool,trace=sync',
  43. ],
  44. volumeMounts: [
  45. {
  46. name: 'subkey-data',
  47. mountPath: dataPath,
  48. },
  49. {
  50. name: 'builder-data',
  51. mountPath: builderPath,
  52. },
  53. ],
  54. })
  55. }
  56. return result
  57. }