mirror of https://github.com/zulip/zulip.git
Add support for a development environment with Docker.
This commit is contained in:
parent
e95739961f
commit
ab89ef501f
|
@ -0,0 +1,12 @@
|
||||||
|
FROM ubuntu:trusty
|
||||||
|
|
||||||
|
EXPOSE 9991
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
python-pbs \
|
||||||
|
wget
|
||||||
|
|
||||||
|
RUN useradd -d /home/zulip -m zulip && echo 'zulip ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
|
|
||||||
|
USER zulip
|
||||||
|
WORKDIR /srv/zulip
|
|
@ -259,6 +259,62 @@ To start the development server:
|
||||||
|
|
||||||
… and visit [http://localhost:9991/](http://localhost:9991/).
|
… and visit [http://localhost:9991/](http://localhost:9991/).
|
||||||
|
|
||||||
|
Using Docker
|
||||||
|
-------------
|
||||||
|
|
||||||
|
You can also use Docker to develop, first you need to install Docker in your development machine following the [instructions](https://docs.docker.com/engine/installation/). Some other interesting links for somebody new in Docker are:
|
||||||
|
|
||||||
|
* [Get Started](https://docs.docker.com/linux/started/)
|
||||||
|
* [Understand the architecture](https://docs.docker.com/engine/introduction/understanding-docker/)
|
||||||
|
* [Docker run reference]https://docs.docker.com/engine/reference/run/()
|
||||||
|
* [Dockerfile reference](https://docs.docker.com/engine/reference/builder/)
|
||||||
|
|
||||||
|
Then you should create the Docker image based on Ubuntu Linux, first go to the directory with the Zulip source code:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker build -t user/zulipdev .
|
||||||
|
```
|
||||||
|
|
||||||
|
Now you're going to install Zulip dependencies in the image:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -itv $(pwd):/srv/zulip -p 80:9991 user/zulipdev /bin/bash
|
||||||
|
$ /usr/bin/python /srv/zulip/provision.py --docker
|
||||||
|
docker ps -af ancestor=user/zulipdev
|
||||||
|
docker commit -m "Zulip installed" <container id> user/zulipdev:v2
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally you can run the docker server with:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -itv $(pwd):/srv/zulip -p 80:9991 user/zulipdev:v2 /srv/zulip/scripts/start-dockers
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to connect to the Docker instance to build a release tarball you can use:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker ps
|
||||||
|
docker exec -it <container id> /bin/bash
|
||||||
|
$ source /home/zulip/.bash_profile
|
||||||
|
$ <Your commands>
|
||||||
|
$ exit
|
||||||
|
```
|
||||||
|
|
||||||
|
To stop the server use:
|
||||||
|
```
|
||||||
|
docker ps
|
||||||
|
docker kill <container id>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to run all the tests you need to start the servers first, you can do it with:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -itv $(pwd):/srv/zulip user/zulipdev:v2 /bin/bash
|
||||||
|
$ scripts/test-all-docker
|
||||||
|
```
|
||||||
|
|
||||||
|
You can modify the source code in your development machine and review the results in your browser.
|
||||||
|
|
||||||
|
|
||||||
Using the Development Environment
|
Using the Development Environment
|
||||||
=================================
|
=================================
|
||||||
|
|
|
@ -51,7 +51,7 @@ if not os.path.exists(os.path.join(os.path.dirname(__file__), ".git")):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# TODO: Parse arguments properly
|
# TODO: Parse arguments properly
|
||||||
if "--travis" in sys.argv:
|
if "--travis" in sys.argv or "--docker" in sys.argv:
|
||||||
ZULIP_PATH="."
|
ZULIP_PATH="."
|
||||||
|
|
||||||
# tsearch-extras is an extension to postgres's built-in full-text search.
|
# tsearch-extras is an extension to postgres's built-in full-text search.
|
||||||
|
@ -164,6 +164,12 @@ def main():
|
||||||
os.system("sudo service rabbitmq-server restart")
|
os.system("sudo service rabbitmq-server restart")
|
||||||
os.system("sudo service redis-server restart")
|
os.system("sudo service redis-server restart")
|
||||||
os.system("sudo service memcached restart")
|
os.system("sudo service memcached restart")
|
||||||
|
elif "--docker" in sys.argv:
|
||||||
|
os.system("sudo service rabbitmq-server restart")
|
||||||
|
os.system("sudo pg_dropcluster --stop 9.3 main")
|
||||||
|
os.system("sudo pg_createcluster -e utf8 --start 9.3 main")
|
||||||
|
os.system("sudo service redis-server restart")
|
||||||
|
os.system("sudo service memcached restart")
|
||||||
sh.configure_rabbitmq(**LOUD)
|
sh.configure_rabbitmq(**LOUD)
|
||||||
sh.postgres_init_dev_db(**LOUD)
|
sh.postgres_init_dev_db(**LOUD)
|
||||||
sh.do_destroy_rebuild_database(**LOUD)
|
sh.do_destroy_rebuild_database(**LOUD)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo service rabbitmq-server restart
|
||||||
|
sudo service postgresql restart
|
||||||
|
sudo service redis-server restart
|
||||||
|
sudo service memcached restart
|
||||||
|
source /home/zulip/.bash_profile
|
||||||
|
/srv/zulip/scripts/setup/configure-rabbitmq
|
||||||
|
/srv/zulip/tools/run-dev.py --interface=''
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo service rabbitmq-server restart
|
||||||
|
sudo service postgresql restart
|
||||||
|
sudo service redis-server restart
|
||||||
|
sudo service memcached restart
|
||||||
|
source /home/zulip/.bash_profile
|
||||||
|
/srv/zulip/tools/test-all
|
Loading…
Reference in New Issue