diff --git a/.gitignore b/.gitignore index ab59b88fc..a75f90f78 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ test_project/modoboa.db /.project /.pydevproject + +# Misc +.ash_history diff --git a/doc/contributing/getting_started.rst b/doc/contributing/getting_started.rst index f45b65f07..d286a4a0d 100644 --- a/doc/contributing/getting_started.rst +++ b/doc/contributing/getting_started.rst @@ -17,7 +17,7 @@ Then, just run the following command:: $ docker-compose up It will start the docker environment and make a Modoboa instance -available at ``http://localhost:8000``. +available at ``http://localhost:8000`` and the new admin interface at ``http://localhost:8080`` If you don't want to use docker or need a more complex development setup, go to the next section. diff --git a/docker-compose.yml b/docker-compose.yml index 5630bfb11..60c9a211a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: '3' services: - web: + api: + container_name: modoboa_api + restart: always build: context: . - dockerfile: Dockerfile.dev - expose: - - "8000" + dockerfile: docker/Dockerfile.dev ports: - - "8000:8000" + - 8000:8000 environment: PYTHONPATH: ".." DB: "SQLITE" @@ -16,3 +16,20 @@ services: command: sh -c "cd test_project && python3 manage.py migrate && python3 manage.py load_initial_data && python3 manage.py runserver 0:8000" volumes: - .:/code + + front: + container_name: modoboa_front + restart: always + build: + context: . + dockerfile: docker/Dockerfile.front.dev + ports: + - 8080:8080 + command: "" + volumes: + - ./frontend/:/home/node/ + command: "yarn serve" + environment: + DOCKER: "yes" + depends_on: + - api diff --git a/Dockerfile.dev b/docker/Dockerfile.dev similarity index 100% rename from Dockerfile.dev rename to docker/Dockerfile.dev diff --git a/docker/Dockerfile.front.dev b/docker/Dockerfile.front.dev new file mode 100644 index 000000000..8149784bc --- /dev/null +++ b/docker/Dockerfile.front.dev @@ -0,0 +1,7 @@ +FROM node:16.10-alpine + +ENV HOME=/home/node/ + +WORKDIR $HOME + +RUN yarn install diff --git a/frontend/.yarnrc b/frontend/.yarnrc new file mode 100644 index 000000000..199188096 --- /dev/null +++ b/frontend/.yarnrc @@ -0,0 +1,5 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +lastUpdateCheck 1676556135834 diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 04e0c0436..3ceebaec0 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,16 +1,15 @@ module.exports = { devServer: { proxy: { - '/api': { - target: 'http://localhost:8000/' - } - } + "/api": { + target: + process.env.DOCKER == "yes" + ? "http://api:8000/" + : "http://localhost:8000", + }, + }, }, - transpileDependencies: [ - 'vuetify' - ], - publicPath: process.env.NODE_ENV === 'production' - ? '/new-admin/' - : '/', - outputDir: '../modoboa/frontend_dist' -} + transpileDependencies: ["vuetify"], + publicPath: process.env.NODE_ENV === "production" ? "/new-admin/" : "/", + outputDir: "../modoboa/frontend_dist", +}; diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index 19ce64b57..cb5705ed0 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -28,6 +28,7 @@ SECRET_KEY = '!8o(-dbbl3e+*bh7nx-^xysdt)1gso*%@4ze4-9_9o+i&t--u_' DEBUG = 'DEBUG' in os.environ ALLOWED_HOSTS = [ + 'api', '127.0.0.1', 'localhost', ]