-
Notifications
You must be signed in to change notification settings - Fork 4
Setting up a new server
This tutorial is for setting up a new complete Mapic server on localhost.
# 1. Download this repository to your local machine
cd /
git clone git@github.com:systemapic/docker-systemapic.git /docks/
cd /docks/
# 2. Initialize submodules
git submodule init
git submodule update --recursive --remote
git submodule foreach git pull origin master
git submodule foreach checkout master
# make sure all submodules are updated and on master branch
# 3. Download default config, and put in /docks/config/localhost folder
git clone git@github.com:systemapic/default-config.git config/
cd config
# make sure /localhost/ folder is there, full path should be /docks/config/localhost/
# 4. set local ENV
export SYSTEMAPIC_DOMAIN=localhost
# 5. get code
cd /docks/modules/wu
git pull origin master
# or git clone git@github.com:systemapic/wu.git /docks/modules/wu
# get front-end code
cd /docks/modules/wu
git clone git@github.com:systemapic/systemapic.js.git public
cd public
git checkout master
cd /docks/modules/pile
git pull origin master
# or git clone git@github.com:systemapic/pile.git /docks/modules/pile
# 6. Try building Docker images
# create storage containers
cd /docks/compose/
./create_storage_containers.sh # This will attempt to download needed images and create containers
# start server
./restart.sh # This will download more needed images, and start server.
# 7. Start troubleshooting! :)
# 8. Make a script that repeats all these steps, and install a working localhost automatically. :)# enter the running docker container for 'wu'
docker exec -it localhost_wu_1 fish
# you're now inside the running docker container
cd scripts
node create_user.js # read instructions
node make_super.js # read instructions to make new user a superuser (admin)
# to exit running container (without stopping it)
exit
docker images # see all images
docker ps # see all running containers
docker ps -a # see all containers
# see logs of running containers
cd /docks/compose
./logs.sh
# restart containers
cd /docks/compose
./restart.shWhen running containers, this is controlled by docker-compose and the .yml files in /docks/compose/. The repository with the wu and pile code is actually mapped to your host computer, so that when you're running the Docker container, it's still the code in your host computer that's used. This is good for coding, dev mode. So you run the containers, but you edit the code on your HOST computer. Servers will automatically restart on code-change.
So for example, with the wu repository, the Docker container is localhost_wu_1 (when running), based on the configuration in /docks/compose/yml/localhost.yml and common.yml files. The folder /systemapic/dev inside the container is mapped to your host /docks/modules/wu folder - it's the same folder. So when you do changes on the /docks/modules/wu/ files on host, these changes are also reflected inside the container in /systemapic/dev.
Same with pile.
Node modules in wu and pile needs to be installed. Enter root directory of each repository, delete node_modules folder and npm install. This has to be done from within the running containers, because NPM reads from ENV (which is different on host computer and inside container). This needs to be done on both wu and pile.
docker exec -it localhost_wu_1 fish # enter the container. `fish` is just a bash
# and docker exec -it localhost_pile_1 fish
cd /systemapic/dev/ # folder mapped to your host computers /docks/modules/wu ... or /pile
rm -r node_modules
npm install
exit