Pārlūkot izejas kodu

refactor: Moved all dev/docker files to /tools folder

NGPixel 7 gadi atpakaļ
vecāks
revīzija
5f415a4045
16 mainītis faili ar 42 papildinājumiem un 110 dzēšanām
  1. 0 3
      .babelrc
  2. 0 17
      .build/.deployexclude
  3. 0 4
      .build/docker_init.sh
  4. 0 45
      .travis.yml
  5. 0 17
      Dockerfile
  6. 11 9
      README.md
  7. 3 3
      package.json
  8. 1 1
      test/lint.js
  9. 12 0
      tools/Dockerfile
  10. 8 4
      tools/docker-compose.yml
  11. 7 6
      tools/fuse.js
  12. 0 0
      tools/fuse_tasks.js
  13. 0 0
      tools/pug-lintrc.json
  14. 0 0
      tools/semver_next.sh
  15. 0 0
      tools/tsconfig.json
  16. 0 1
      wiki.cmd

+ 0 - 3
.babelrc

@@ -1,3 +0,0 @@
-{
-  "presets": ["es2015"]
-}

+ 0 - 17
.build/.deployexclude

@@ -1,17 +0,0 @@
-client
-coverage
-data
-logs
-node_modules
-npm
-repo
-test
-.*
-*.log
-*.tar.gz
-*.zip
-config.yml
-docker-compose.yml
-Dockerfile
-fuse.js
-yarn.lock

+ 0 - 4
.build/docker_init.sh

@@ -1,4 +0,0 @@
-#!/bin/ash
-apk add bash curl git openssh
-cd /var/www
-node server

+ 0 - 45
.travis.yml

@@ -1,45 +0,0 @@
-language: node_js
-node_js:
-- '8'
-branches:
-  except:
-    - docker
-addons:
-  apt:
-    sources:
-    - ubuntu-toolchain-r-test
-    packages:
-    - g++-4.8
-env:
-  global:
-  - CXX=g++-4.8
-  - secure: VCgscCCKhvHu0tW8e3jo6wydckE6jDkEfC2Zd5aSZytYAex05qahU45cmksqMIT1uBCcC4CKRK4caoKac/+818EyKBTV+vAL74cMMc8NeLNVY2m50+ohu8GYu+ByIffttK7cnXN7xIzyuK4csI7qz84jxLW0KYgYQ+6SPbUG3Hy6gr0P0CztNmAFfyhTam4OKSIiXyvQZW0fZoSruOpUYS5pxvCBi4AxpRY8+6IxCL8xYqF49P0l28nn0C/NYUklwag6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gNk0vrTEVjW+Z/b3XMhVwVlwmTuVM5wylzaZRcc=
-cache: yarn
-before_script:
-- yarn run build
-before_deploy:
-- tar -chzf wiki-js.tar.gz * -X .build/.deployexclude
-- yarn install --production --ignore-scripts --prefer-offline
-- tar -chzf node_modules.tar.gz -C node_modules .
-deploy:
-  provider: releases
-  api_key:
-    secure: TyasQ2QnWQoBhsiwm88oHoeJ+PWBZnbWEJwu6JdN5HA9cXqIdHqd1msCh84gGtKRfL2EObw4AvDwLSEd5mIM0cmQfTiokYbmb7OSjOq880rbZwtXt9t9KkC5b+TIxkhJzkzi7vIpssTeNkVJBbo/R3m0suaCRqzypkW5mhVcsFhhZ8oVCZnI1uZAXCwFNMcFFUAHxWYE98tW5bfxknRU1NJFcXysN8VXskIZ82wQQBAzZ1aQgVyMl6Uw2hns399hxCx8gVKWOIdbpO1bliHBMdm5z+lR5i723IQnHpYJf4gWvPf3oHnSS1ocrJeWVoBqanC5Iu3QhwOvPLPw/AUcJOqhvS/QiGZ2AuA9GwtBpYNVYYGD9RqcODBKZy0fWluwCuVNNoQHmwMWVP7lRnwP+SNtLzzV5ZC8mrjb4B9KGoBUR8Q7lz8cMtLoPOixk1WdWOpIFzKcw/fy8Ze6cnnFKrzsPVUZy3E3SKit3GuP6Nd7ghO0Kxp4x0eAlqFDYRZ9nG55ctd0i2b5u1r+VArt21dk2aMFxL6i67funIraEndLQFHhRgPVmjemJBRXf8j8OYrGStTsm0S26IXo3iVh/NJakIg6mEFJ3j4BXPEjCUmIW0iD6sKGTeNH6jaON+DV4T+ErGnYzgwO5KIfo9cI00DqjG0tjBQ45lWaLGy6PEo=
-  file:
-    - wiki-js.tar.gz
-    - node_modules.tar.gz
-  skip_cleanup: true
-  overwrite: true
-  on:
-    branch: master
-    repo: Requarks/wiki
-    tags: true
-    node: '8'
-notifications:
-  webhooks:
-    urls:
-      - https://webhooks.gitter.im/e/56b27cb2ec4692419db9
-    on_success: change
-    on_failure: always
-    on_start: never

+ 0 - 17
Dockerfile

@@ -1,17 +0,0 @@
-FROM node:8-alpine
-
-RUN apk update && apk upgrade && \
-    apk add --no-cache bash git openssh
-
-ENV WIKI_JS_DOCKER 1
-
-WORKDIR /usr/src/app
-COPY assets assets/
-COPY server server/
-COPY npm/configs/config.passive.yml config.yml
-COPY package.json package.json
-COPY LICENSE LICENSE
-RUN npm install --only=production --no-optional
-
-EXPOSE 3000
-ENTRYPOINT [ "node", "server" ]

+ 11 - 9
README.md

@@ -14,7 +14,8 @@
 ##### A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown
 
 - [Official Website](https://wiki.js.org/)
-- [Documentation](#documentation)
+- **[Getting Started](https://wiki.js.org/get-started.html)**
+- [Documentation](https://docs.requarks.io/wiki/)
 - [Requirements](#requirements)
 - [Change Log](https://github.com/Requarks/wiki/blob/master/CHANGELOG.md)
 - [Feature Requests](https://wikijs.canny.io/features)
@@ -23,12 +24,6 @@
 - [Translations](#translations) *(We need your help!)*
 - [Special Thanks](#special-thanks)
 
-## Documentation
-
-- [Installation Guide](https://wiki.js.org/get-started.html)
-- [Admin Guide](https://docs.requarks.io/wiki/#admin-guide)
-- [User Guide](https://docs.requarks.io/wiki/#user-guide)
-
 ## Requirements
 
 Wiki.js can run on virtually all platforms where Node.js can (Windows, Mac, Linux, etc.).
@@ -43,10 +38,17 @@ Wiki.js can run on virtually all platforms where Node.js can (Windows, Mac, Linu
 ## Cloud Install
 
 [![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/requarks/wiki-heroku)
-[![Docker Image](https://raw.githubusercontent.com/Requarks/wiki-site/master/assets/images/docker-deploy.png)](https://hub.docker.com/r/requarks/wiki/)
 
 *Docker Cloud, Azure, IBM Bluemix and more coming soon!*
 
+## Docker
+
+A docker Wiki.js image is available on Docker Hub:
+
+[![Docker Image](https://raw.githubusercontent.com/Requarks/wiki-site/master/assets/images/docker-deploy.png)](https://hub.docker.com/r/requarks/wiki/)
+
+You can also use a Dockerfile ([see example]()) or Docker Compose ([see example]()) to run Wiki.js.
+
 ## Milestones
 
 Current and upcoming milestones *(major features only, see the [changelog](https://github.com/Requarks/wiki/blob/master/CHANGELOG.md) for complete list of features and bug fixes)*:
@@ -74,7 +76,7 @@ Current and upcoming milestones *(major features only, see the [changelog](https
 - [x] Migrate to PostgreSQL + Redis datastore
 - [ ] History / Revert to previous version
 - [ ] Optional Two-Steps Authentication (2FA)
-- [ ] Docker support + Auto compile/publish to Docker Hub
+- [x] Docker support + Auto compile/publish to Docker Hub
 - [ ] Support sub-directory installations (e.g. example.com/wiki)
 - [ ] Persist system settings to database instead of file-based
 - [ ] User Groups + Better permissions management

+ 3 - 3
package.json

@@ -7,9 +7,9 @@
     "start": "node wiki start",
     "stop": "node wiki stop",
     "restart": "node wiki restart",
-    "build": "node fuse",
-    "dev": "node fuse -d",
-    "dev-configure": "node fuse -c",
+    "build": "node tools/fuse",
+    "dev": "node tools/fuse -d",
+    "dev-configure": "node tools/fuse -c",
     "test": "jest"
   },
   "bin": {

+ 1 - 1
test/lint.js

@@ -69,7 +69,7 @@ describe('Code Linting', () => {
   it('should pass PugLint validation', () => {
     const PugLint = require('pug-lint')
     const lint = new PugLint()
-    const pugConfig = fs.readJsonSync('.pug-lintrc.json')
+    const pugConfig = fs.readJsonSync('tools/.pug-lintrc.json')
     lint.configure(pugConfig)
     let report = lint.checkPath('./server/views')
     expect(report).toPugLint()

+ 12 - 0
tools/Dockerfile

@@ -0,0 +1,12 @@
+FROM requarks/wiki:latest
+
+# Replace with your email address:
+ENV WIKI_ADMIN_EMAIL admin@example.com
+
+WORKDIR /var/wiki
+
+# Replace your-config.yml with the path to your config file:
+ADD your-config.yml config.yml
+
+EXPOSE 3000
+ENTRYPOINT [ "node", "server" ]

+ 8 - 4
docker-compose.yml → tools/docker-compose.yml

@@ -2,14 +2,18 @@ version: '3'
 services:
   wikidb:
     image: mongo
-    ports:
-      - '27017:27017'
+    expose:
+      - '27017'
     command: '--smallfiles --logpath=/dev/null'
+    volumes:
+      - ./data/mongo:/data/db
   wikijs:
     image: 'requarks/wiki:latest'
     links:
       - wikidb
     ports:
-      - '3000:3000'
+      - '80:3000'
     environment:
-      - PORT=3000
+      - WIKI_ADMIN_EMAIL: admin@example.com
+    volumes:
+      - ./config.yml:/var/wiki/config.yml

+ 7 - 6
fuse.js → tools/fuse.js

@@ -58,15 +58,15 @@ const ALIASES = {
 }
 const SHIMS = {
   jquery: {
-    source: 'node_modules/jquery/dist/jquery.js',
+    source: '../node_modules/jquery/dist/jquery.js',
     exports: '$'
   },
   diff2html: {
-    source: 'node_modules/diff2html/dist/diff2html.min.js',
+    source: '../node_modules/diff2html/dist/diff2html.min.js',
     exports: 'Diff2Html'
   },
   diff2htmlui: {
-    source: 'node_modules/diff2html/dist/diff2html-ui.min.js',
+    source: '../node_modules/diff2html/dist/diff2html-ui.min.js',
     exports: 'Diff2HtmlUI'
   }
 }
@@ -76,7 +76,7 @@ const SHIMS = {
 // ======================================================
 
 console.info(colors.white('└── ') + colors.green('Running global tasks...'))
-let globalTasks = require('./.build/_tasks')
+let globalTasks = require('./fuse_tasks')
 
 // ======================================================
 // Fuse Tasks
@@ -84,10 +84,11 @@ let globalTasks = require('./.build/_tasks')
 
 globalTasks.then(() => {
   let fuse = fsbx.FuseBox.init({
-    homeDir: './client',
-    output: './assets/js/$name.js',
+    homeDir: '../client',
+    output: '../assets/js/$name.js',
     alias: ALIASES,
     target: 'browser',
+    tsConfig: './tsconfig.json',
     plugins: [
       fsbx.EnvPlugin({ NODE_ENV: (dev) ? 'development' : 'production' }),
       fsbx.VuePlugin(),

+ 0 - 0
.build/_tasks.js → tools/fuse_tasks.js


+ 0 - 0
.pug-lintrc.json → tools/pug-lintrc.json


+ 0 - 0
.build/semver_next.sh → tools/semver_next.sh


+ 0 - 0
tsconfig.json → tools/tsconfig.json


+ 0 - 1
wiki.cmd

@@ -1 +0,0 @@
-@node "%~dp0wiki.js" %*