diff --git a/DOCKER_MORE_CLOSELY.md b/DOCKER_MORE_CLOSELY.md index e4b40579e..592b5bb9b 100644 --- a/DOCKER_MORE_CLOSELY.md +++ b/DOCKER_MORE_CLOSELY.md @@ -13,6 +13,26 @@ To set the Docker platform environment variable in your terminal tab, run: $ export DOCKER_DEFAULT_PLATFORM=linux/amd64 ``` +### Docker Compose Override File For Apple M1 Platform + +For Docker compose `up` or `build` commands, you can use our Apple M1 override file that specifies the M1 platform: + +```bash +# in main folder + +# for development +$ docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.apple-m1.override.yml up +# clean db +$ docker compose exec backend yarn db:reset +# seed db +$ docker compose exec backend yarn db:seed + +# for production +$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up +# init admin user +$ docker compose exec backend /bin/sh -c "yarn prod:migrate init" +``` + ## Analysing Docker Builds To analyze a Docker build, there is a wonderful tool called [dive](https://github.com/wagoodman/dive). Please sponsor if you're using it! diff --git a/docker-compose.apple-m1.override.yml b/docker-compose.apple-m1.override.yml new file mode 100644 index 000000000..cbb041c51 --- /dev/null +++ b/docker-compose.apple-m1.override.yml @@ -0,0 +1,34 @@ +version: "3.4" + +services: + + ######################################################## + # WEBAPP ############################################### + ######################################################## + webapp: + platform: linux/amd64 + + ######################################################## + # BACKEND ############################################## + ######################################################## + backend: + platform: linux/amd64 + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + platform: linux/amd64 + + ######################################################## + # NEO4J ################################################ + ######################################################## + neo4j: + platform: linux/amd64 + + ######################################################## + # MAILSERVER TO FAKE SMTP ############################## + ######################################################## + # commented out, because otherwise override of production would error. and it seems unnecessary + # mailserver: + # platform: linux/amd64 diff --git a/docker-compose.maintenance.yml b/docker-compose.maintenance.yml index 56da9be52..831bb3f4a 100644 --- a/docker-compose.maintenance.yml +++ b/docker-compose.maintenance.yml @@ -1,3 +1,5 @@ +# Todo: !!! This file seems related to our old maintenance worker for MongoDB and has to be refactored in case of using it !!! + version: "3.4" services: diff --git a/docker-compose.override.yml b/docker-compose.override.yml index ff2a398bb..d8a3edc06 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,11 +1,13 @@ version: "3.4" services: + ######################################################## # WEBAPP ############################################### ######################################################## webapp: - image: ocelotsocialnetwork/webapp:development + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/webapp:local-development build: target: development environment: @@ -18,11 +20,13 @@ services: - webapp_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./webapp:/app + ######################################################## # BACKEND ############################################## ######################################################## backend: - image: ocelotsocialnetwork/backend:development + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/backend:local-development build: target: development environment: @@ -34,22 +38,27 @@ services: - backend_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./backend:/app + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/maintenance:local-development + ######################################################## # NEO4J ################################################ ######################################################## neo4j: - image: ocelotsocialnetwork/neo4j-community:development + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/neo4j-community:local-development ports: # Also expose the neo4j query browser - 7474:7474 networks: # So we can access the neo4j query browser from our host machine - external-net - ######################################################## - # MAINTENANCE ########################################## - ######################################################## - maintenance: - image: ocelotsocialnetwork/maintenance:development + ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## diff --git a/docker-compose.test.yml b/docker-compose.test.yml index d11ecde54..fa858f28c 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -1,10 +1,12 @@ version: "3.4" services: + ######################################################## # WEBAPP ############################################### ######################################################## webapp: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there image: ocelotsocialnetwork/webapp:test build: target: test @@ -12,10 +14,12 @@ services: - NODE_ENV="test" volumes: - ./coverage:/app/coverage + ######################################################## # BACKEND ############################################## ######################################################## backend: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there image: ocelotsocialnetwork/backend:test build: target: test @@ -23,10 +27,19 @@ services: - NODE_ENV="test" volumes: - ./coverage:/app/coverage + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/maintenance:test + ######################################################## # NEO4J ################################################ ######################################################## neo4j: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there image: ocelotsocialnetwork/neo4j-community:test #environment: # - NEO4J_dbms_connector_bolt_enabled=true @@ -39,11 +52,7 @@ services: networks: # So we can access the neo4j query browser from our host machine - external-net - ######################################################## - # MAINTENANCE ########################################## - ######################################################## - maintenance: - image: ocelotsocialnetwork/maintenance:test + ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## diff --git a/docker-compose.yml b/docker-compose.yml index 863fb2c25..154a8fd4c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,11 +6,13 @@ version: "3.4" services: + ######################################################## # WEBAPP ############################################### ######################################################## webapp: - image: ocelotsocialnetwork/webapp:latest + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/webapp:local-production build: context: ./webapp target: production @@ -35,11 +37,13 @@ services: - GRAPHQL_URI=http://backend:4000 env_file: - ./webapp/.env + ######################################################## # BACKEND ############################################## ######################################################## backend: - image: ocelotsocialnetwork/backend:latest + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/backend:local-production build: context: ./backend target: production @@ -67,11 +71,28 @@ services: - CLIENT_URI=http://webapp:3000 env_file: - ./backend/.env + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## + maintenance: + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/maintenance:local-production + build: + # TODO: Separate from webapp, this must be independent + context: ./webapp + dockerfile: Dockerfile.maintenance + networks: + - external-net + ports: + - 3001:80 + ######################################################## # NEO4J ################################################ ######################################################## neo4j: - image: ocelotsocialnetwork/neo4j-community:latest + # name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there + image: ocelotsocialnetwork/neo4j-community:local-production build: context: ./neo4j # community edition 👆🏼, because we have no enterprise licence 👇🏼 at the moment @@ -90,19 +111,6 @@ services: # TODO: clarify if that is the only thing needed to unlock the Enterprise version # - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes # TODO: Remove the playground from production - ######################################################## - # MAINTENANCE ########################################## - ######################################################## - maintenance: - image: ocelotsocialnetwork/maintenance:latest - build: - # TODO: Separate from webapp, this must be independent - context: ./webapp - dockerfile: Dockerfile.maintenance - networks: - - external-net - ports: - - 5000:80 networks: external-net: diff --git a/webapp/maintenance/README.md b/webapp/maintenance/README.md index 99e410a1c..95c09bae8 100644 --- a/webapp/maintenance/README.md +++ b/webapp/maintenance/README.md @@ -36,4 +36,4 @@ $ docker-compose up ```` And the maintenance mode page or service will be started as well in an own container. -In the browser you can reach it under `http://localhost:5000/`. +In the browser you can reach it under `http://localhost:3001/`.