Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 0 additions & 80 deletions Dockerfile

This file was deleted.

10 changes: 4 additions & 6 deletions Dockerfile.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources
# Postgres
RUN curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt-get update -qq && apt-get dist-upgrade --yes && \
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D870AB033FB45BD1 && \
apt-get update -qq && apt-get dist-upgrade --yes && \
apt-get install --yes pkg-config apt-utils build-essential cmake automake && \
apt-get upgrade --fix-missing --yes --allow-remove-essential \
-o Dpkg::Options::="--force-confold"
Expand Down Expand Up @@ -72,12 +73,9 @@ RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf
RUN chown app -R ./

EXPOSE 3000
ADD entrypoint.sh /sbin/
COPY entrypoint.sh /sbin/entrypoint.sh
RUN chmod 755 /sbin/entrypoint.sh
ADD entrypoint-que.sh /sbin/
COPY entrypoint-que.sh /sbin/entrypoint-que.sh
RUN chmod 755 /sbin/entrypoint-que.sh
RUN mkdir -p /etc/my_init.d
RUN ln -s /sbin/entrypoint.sh /etc/my_init.d/entrypoint.sh
RUN echo 'export PATH=$PATH:./bin:/usr/local/rvm/rubies/ruby-2.7.7/bin'>> /root/.bashrc
RUN echo 'alias rspec="bundle exec rspec"' >> /root/.bashrc
ENTRYPOINT ["/sbin/entrypoint.sh"]
4 changes: 2 additions & 2 deletions Passengerfile.json.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"environment": "development",
"address": "0.0.0.0",
"port": 80,
"port": 8000,
"daemonize": false,
"user": "app",
"ssl": false,
"nginx_config_template": "/home/app/workshops/nginx.conf.erb",
"nginx_config_template": "/home/app/workshops/nginx.conf.erb"
}
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,24 @@ The application is setup to work in a [Docker](http://www.docker.com) container.
```

3. Edit the lib/tasks/ws.rake file to change default user account information, to set your own credentials for logging into the
Workshops web interface. The default accounts are setup by the entrypoint.sh script running:
`rake ws:create_admins RAILS_ENV=development`.
Workshops web interface. The default accounts are setup by the `entrypoint.sh` script running the `ws:create_admins` rake task.

4. Edit docker-compose.yml to set your preferred usernames and passwords in the environment variables. Note the instructions
at the top for creating data containers, for storing database and ruby gems persistently. Also add random strings for the
environment variables, such as SECRET_KEY_BASE, DEVISE_SECRET_KEY, etc..
4. Edit docker-compose.yml to set your preferred usernames and passwords in the environment variables. The default is to use docker
volumes for storage - in production this should be reviewed. Set random
values for SECRET_KEY_BASE, DEVISE_SECRET_KEY etc. (e.g. `openssl rand -hex 64`)

5. Review the entrypoint script. It assumes that you want to run the
development environment and starting from an empty database. In particular,
you may want to comment out the `ws:init_settings` task.

The first time the database container is run, databases and database accounts will be created via the script at
`./db/pg-init/init-user-db.sh`. It uses the environment variables that you set in docker-compose.yml.

5. If you want your instance to be accessible at a domain, edit nginx.conf.erb to change `server_name YOUR.HOSTNAME.COM;`.
6. The first time the database container is run, databases and database accounts will be created via the script at
`./db/pg-init/init-user-db.sh`. It uses the environment variables that you set in docker-compose.yml.

6. Run `docker-compose up` (or possibly `docker build .` first).
7. Run `docker compose build` to build the container(s) and then
`docker compose up` to bring the system up.

7. Login to the web interface (http://localhost) with the account you setup in ws.rake, and visit /settings (click the
8. Login to the web interface (http://localhost) with the account you setup in ws.rake, and visit /settings (click the
drop-down menu in the top-right and choose "Settings"). Update the Site settings with your preferences.

8. Optional: if you would like to seed the database with fake events and random data, checkout the (bottom of the) `db/seed.rb` file.
Expand Down
2 changes: 1 addition & 1 deletion db/pg-init/init-user-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo
psql -U "$POSTGRES_USER" -c "CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS';"
echo

for db in workshops_test workshops_development workshops_production
for db in workshops_test workshops_development workshops_production que_jobs
do
echo
echo "Setting up $db database..."
Expand Down
29 changes: 19 additions & 10 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
# Generate secure strings using:
# < /dev/urandom LC_CTYPE=C tr -dc _A-Z-a-z-0-9 | head -c${1:-64};echo


version: '3.8'
services:
db:
image: postgres:9.6.5
container_name: wsdb
volumes:
- ./db/pg-init:/docker-entrypoint-initdb.d
volumes:
- pgdata:/var/lib/postgresql/data
environment:
- POSTGRES_USER=postgres
Expand All @@ -29,22 +26,33 @@ services:
- DB_NAME=workshops_production,workshops_development,workshops_test
- DB_USER=wsuser
- DB_PASS=yyyyyyyyyyyyyyy
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5

web:
build: .
container_name: ws
command: /sbin/entrypoint.sh
ports:
- '80:80'
- '8000:8000'
volumes:
- ./:/home/app/workshops
- ./entrypoint.sh:/sbin/entrypoint.sh
- /Users/brent/rails/ssh-keys:/root/.ssh
- rubygems:/usr/local/rvm/gems
- rubygems:/home/app/workshops/vendor/cache
links:
- db
environment:
healthcheck:
# Building gems can be slow.........
test: curl -f http://localhost:8000/ || exit 1
interval: 60s
timeout: 10s
retries: 6
start_period: 240s
environment: &environment
- DB_USER=wsuser
- DB_PASS=yyyyyyyyyyyyyyy
- DB_HOST=db
Expand Down Expand Up @@ -78,10 +86,11 @@ services:
- rubygems:/home/app/workshops/vendor/cache
environment: *environment
depends_on:
- web
networks:
- workshops
- nginx-proxy
db:
condition: service_healthy
web:
condition: service_healthy


# adding labels allows pruning of unused system volumes with:
# docker volume prune --filter 'label!=workshops_volume'"
Expand Down
84 changes: 0 additions & 84 deletions entrypoint.sh

This file was deleted.

Loading