Guest User

NPM and Authentik

a guest
Oct 31st, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. Firstly
  2.  
  3. sudo mkdir -p /opt/docker/npm && sudo chown -R $USER:$USER /opt/docker/npm
  4. That would be for your Nguni Proxy Manager
  5. Then
  6. cd /opt/docker/npm
  7. NPM
  8. nano docker-compose.yml
  9. Paste the following:
  10.  
  11. version: '3.8'
  12. services:
  13. app:
  14. image: 'jc21/nginx-proxy-manager:latest'
  15. restart: unless-stopped
  16. ports:
  17. - '80:80'
  18. - '443:443'
  19. - '81:81'
  20. environment:
  21. DB_MYSQL_HOST: "db"
  22. DB_MYSQL_PORT: 3306
  23. DB_MYSQL_USER: "npm"
  24. DB_MYSQL_PASSWORD: “A-strongPassword”
  25. DB_MYSQL_NAME: "npm"
  26. volumes:
  27. - ./data:/data
  28. - ./letsencrypt:/etc/letsencrypt
  29. depends_on:
  30. - db
  31. networks:
  32. - npm-proxy
  33.  
  34. db:
  35. image: 'jc21/mariadb-aria:latest'
  36. restart: unless-stopped
  37. environment:
  38. MYSQL_ROOT_PASSWORD: ‘SAME strongPassword as above’
  39. MYSQL_DATABASE: 'npm'
  40. MYSQL_USER: 'npm'
  41. MYSQL_PASSWORD: 'SAME strongPassword as above'
  42. volumes:
  43. - ./mysql:/var/lib/mysql
  44. networks:
  45. - npm-proxy # Add the network here
  46.  
  47. networks:
  48. npm-proxy: # Define the network
  49. external: true
  50.  
  51. THEN: docker-compose up -d
  52. GO THROUGH NPM setup by GOING to http://YourIP:81
  53.  
  54.  
  55. NOW FOR AUTHENTIK
  56. sudo mkdir -p /opt/docker/npm && sudo chown -R $USER:$USER /opt/docker/npm
  57. Then
  58. cd /opt/docker/npm
  59. THEN
  60. nano docker-compose.yml PASTE THE FOLLOWING AND SAVE
  61.  
  62. version: "3.4"
  63.  
  64. services:
  65. postgresql:
  66. image: docker.io/library/postgres:12-alpine
  67. restart: unless-stopped
  68. healthcheck:
  69. test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
  70. start_period: 20s
  71. interval: 30s
  72. retries: 5
  73. timeout: 5s
  74. volumes:
  75. - database:/var/lib/postgresql/data
  76. environment:
  77. POSTGRES_PASSWORD: ${PG_PASS:?database password required}
  78. POSTGRES_USER: ${PG_USER:-authentik}
  79. POSTGRES_DB: ${PG_DB:-authentik}
  80. env_file:
  81. - .env
  82. networks:
  83. - npm-proxy
  84. redis:
  85. image: docker.io/library/redis:alpine
  86. command: --save 60 1 --loglevel warning
  87. restart: unless-stopped
  88. healthcheck:
  89. test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
  90. start_period: 20s
  91. interval: 30s
  92. retries: 5
  93. timeout: 3s
  94. volumes:
  95. - redis:/data
  96. networks:
  97. - npm-proxy
  98. server:
  99. image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2023.8.3}
  100. container_name: authentik
  101. restart: unless-stopped
  102. command: server
  103. environment:
  104. AUTHENTIK_REDIS__HOST: redis
  105. AUTHENTIK_POSTGRESQL__HOST: postgresql
  106. AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
  107. AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
  108. AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
  109. volumes:
  110. - ./media:/media
  111. - ./custom-templates:/templates
  112. env_file:
  113. - .env
  114. depends_on:
  115. - postgresql
  116. - redis
  117. networks:
  118. - npm-proxy
  119. worker:
  120. image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2023.8.3}
  121. restart: unless-stopped
  122. command: worker
  123. environment:
  124. AUTHENTIK_REDIS__HOST: redis
  125. AUTHENTIK_POSTGRESQL__HOST: postgresql
  126. AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
  127. AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
  128. AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
  129. user: root
  130. volumes:
  131. - /var/run/docker.sock:/var/run/docker.sock
  132. - ./media:/media
  133. - ./certs:/certs
  134. - ./custom-templates:/templates
  135. env_file:
  136. - .env
  137. depends_on:
  138. - postgresql
  139. - redis
  140. networks:
  141. - npm-proxy
  142.  
  143. volumes:
  144. database:
  145. driver: local
  146. redis:
  147. driver: local
  148.  
  149. networks:
  150. proxy:
  151. npm-proxy:
  152. external: true
  153.  
  154.  
  155. THEN RUN
  156. sudo apt-get install -y pwgen
  157.  
  158. Next, run the following commands to generate a password and secret key and write them to your .env file:
  159. echo "PG_PASS=$(pwgen -s 40 1)" >> .env
  160. echo "AUTHENTIK_SECRET_KEY=$(pwgen -s 50 1)" >> .env
  161. ———————
  162. An .env file will be created which you can access by typing:
  163. nano .env (you can configure other parameters here)
  164.  
  165.  
  166. Now go to NPM and forward your domain to: (authentik as IP and 9443 in port)
  167. https://authentik:9443 (remember to select https and NOT http on NPM)
  168.  
Advertisement
Add Comment
Please, Sign In to add comment