You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it a little difficult to get a local environment set up for this without digging through the code for database configuration. I think a docker container would make it easier to set up a local development service as well as the eventual deployment to production.
Here's some files which might help get this started:
rundocker.sh (the script to start the local service from)
#!/bin/bash
echo "Stopping any existing containers"
sudo docker rm -f $(sudo docker ps -aq --filter "name=sisters-of-the-road") 2>/dev/null
echo "Building image"
sudo docker build -t sisters-of-the-road/barter:latest .
if [ $? -ne 0 ]; then
echo "Could not build image"
exit 1
fi
echo "Starting container"
sudo docker run -it --name sisters-of-the-road-barter -p 8000:8000 sisters-of-the-road/barter /rundockerserver.sh
Dockerfile
FROM ubuntu:latest
# Prepare all deps
RUN apt-get update
RUN apt-get install -y git-core
RUN apt-get install -y python-setuptools python3-dev build-essential
RUN apt-get install -y python3-pip python3-venv
RUN apt-get install -y npm
RUN apt-get install -y postgresql-9.5
RUN apt-get install -y sudo
### Database set up
USER postgres
RUN ls /etc/postgresql/
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER sisters WITH SUPERUSER PASSWORD 'sisters';" &&\
createdb -O sisters barter
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
CMD ["/usr/lib/postgresql/9.5/bin/postgres", "-D", "/var/lib/postgresql/9.5/main", "-c", "config_file=/etc/postgresql/9.5/main/postgresql.conf"]
### Application set up
USER root
RUN service postgresql start
RUN pip3 install --upgrade pip
RUN python3 -m venv venv
RUN npm install npm@latest -g
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN git clone https://github.com/codeforgoodconf/sisters-of-the-road-admin.git
RUN (cd sisters-of-the-road-admin/; npm install; ./node_modules/.bin/webpack --config webpack.config.js)
RUN (. venv/bin/activate; cd sisters-of-the-road-admin/; pip install --upgrade pip; pip install -r requirements.txt)
COPY rundockerserver.sh /
RUN chmod +x /rundockerserver.sh
EXPOSE 8000
By running the rundocker.sh, it should start a local service up which you can immediately test against and use the default admin account: admin / password.
Let me know what your thoughts are. I'd be willing to help extend this concept if your team find it useful.
Cheers,
Steven
The text was updated successfully, but these errors were encountered:
Hi team,
I found it a little difficult to get a local environment set up for this without digging through the code for database configuration. I think a docker container would make it easier to set up a local development service as well as the eventual deployment to production.
Here's some files which might help get this started:
rundocker.sh (the script to start the local service from)
Dockerfile
rundockerserver.sh
By running the rundocker.sh, it should start a local service up which you can immediately test against and use the default admin account: admin / password.
Let me know what your thoughts are. I'd be willing to help extend this concept if your team find it useful.
Cheers,
Steven
The text was updated successfully, but these errors were encountered: