Open bmenant opened 7 years ago
Hey @bmenant! We're definitely open to external contributions. It'd be great to see Champaign adopted by other organisations and seeing it mature as a product. So far there has been interest shown from other progressive organisations in using Champaign, but nothing that materialised, so SOU are the only ones using – and developing – Champaign at the moment, so your point that the project is pretty tight to SOU needs is partly (or should I say mostly?) true.
You're right in pointing out that it's hard to guess what Champaign actually does! Perhaps as a result us using it internally and not having external collaboration or a community around Champaign, we've been sloppy with documentation.
A bit of an intro... Champaign is a tool that enables campaigners to create campaigns (hope I'm not sounding silly!), so for example campaigners can create petitions, fundraisers, surveys, etc (I've used a few examples from our site). For fundraisers, we currently integrate with Braintree for PayPal and card payments, and GoCardless for direct debit. We've tried to make it quite modular so you don't necessarily need to use all features. We also integrate quite well with ActionKit which is what our campaigners use for email campaigns.
Champaign also supports creating custom (and reusable) templates. The Upstanders website is a good example of a fundraiser page with a custom template 👌 .
If you're interested in getting it up and running, let us know and we can probably help you getting it up and running / deploying it.
Thanks @eyko!
As I said (or not), our own legacy tool is getting older (high technical dept and software entropy). We’re looking forward to change. Should we join in an existing project or rebuild our own system? That is the question. I must carefully inspect features Champaign provides that our legacy tool doesn’t and what would have to be done to catch our legacy tool up.
So, sure, I’d love giving it a try! 😉
So far, I’ve tried to follow the Docker instructions... but it didn’t turn out very well. I tried to do the things step by step on a naked Debian VM, but it didn’t work out well either.
Ok, let’s start over and document the process step by step, following the afore mentioned instructions.
N.B. ⚠️ signs mark any step the instructions are missing out, or whenever I’m having trouble.
$ uname -sr
Linux 4.9.0-3-amd64
$ docker --version
Docker version 17.03.1-ce, build c6d412e
$ docker-compose --version
docker-compose version 1.13.0, build 1719ceb
I assume the first 5 steps aren’t relevant to Linux hosts, where Docker runs natively. I’ll jump ahead to the 6th step. By the way, I guess Docker Machine would come in handy over here.
git clone https://github.com/SumOfUs/Champaign.git && cd Champaign/
touch .env.web
I have no idea what I’m doing, though... ⚠️ cp env.template.yml env.yml
accordingly to docker-compose.yml
I’m not sure if it’s related to config/env.template.yml
or not, that was pretty confusing... I bet those could be merged. ⚠️
SHARE_PROGRESS_API_KEY=
SHARE_PROGRESS_LOG_REQUESTS=
BRAINTREE_TOKEN_URL=http://your-braintree-token-endpoint
EXTERNAL_JS_PATH=/tmp/champlaign
docker-compose.yml
, since PostreSQL is running on a different container (not localhost), we have to set up a password (see PostgreSQL Docker image): ⚠️
diff --git a/docker-compose.yml b/docker-compose.yml
index 264bc849..2138c5ae 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,6 +10,7 @@ web:
- redis
environment:
PG_USERNAME: postgres
- [x] `docker-compose build`
- [ ] `config/secrets.yml` is already there... ⚠️
- [x] `cp config/env.template.yml env.yml`
- [x] Edit `env.yml` I guess we’re talking about `config/env.yml`... ⚠️
PG_USERNAME: postgres PG_PASSWORD: secretpwd PG_HOST: db PG_POST: 5432
- [x] Fix `config/database.yml` since PostgreSQL isn’t running on localhost. ⚠️
```diff
diff --git a/config/database.yml b/config/database.yml
index aa0bb318..d4d56b21 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -21,7 +21,7 @@ development: &default
pool: 5
username: <%= ENV['PG_USERNAME'] %>
password: <%= ENV['PG_PASSWORD'] %>
- host: localhost
+ host: <%= ENV['PG_HOST'] %>
port: <%= ENV['PG_PORT'] %>
docker-compose run web rake db:create
docker-compose run web rake db:schema:load
docker-compose run web rake champaign:seed_liquid
docker-compose run web rspec spec
failed: Webpacker requires Yarn version >= 0.20.1.
:boom:Dockerfile
with yarn and install npm packages... ⚠️
diff --git a/Dockerfile b/Dockerfile
index eb6c2fc0..f1be7e59 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -11,7 +11,9 @@ RUN apt-get update -qq && apt-get install -y apt-transport-https imagemagick
# Install Node.js 7.x
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo 'deb https://deb.nodesource.com/node_7.x jessie main' > /etc/apt/sources.list.d/nodesource.list
-RUN apt-get update -qq && apt-get install -y nodejs
+RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list +RUN apt-get update -qq && apt-get install -y nodejs yarn
RUN mkdir $APP_ROOT @@ -22,5 +24,9 @@ WORKDIR $APP_ROOT RUN if [ $CI = false ]; then bundle install --jobs 4; fi RUN if [ $CI = true ]; then bundle install --jobs 4 --deployment --without development:test:doc; fi
+# Install all npm packages if CI=false. Install production packages if CI=true +RUN if [ $CI = false ]; then yarn install; fi +RUN if [ $CI = true ]; then yarn install --production; fi +
- [x] `docker-build` & cie...
- [x] `docker-compose run web rspec spec` completed: 🎉
2760 examples, 0 failures, 54 pending
Randomized with seed 56941
Let’s try it out
---------
- [x] `docker-compose up`
- [ ] Check that it works:
$ curl -I localhost:3000 HTTP/1.1 302 Found X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff Location: http://example.com Content-Type: text/html; charset=utf-8 Cache-Control: no-cache X-Request-Id: 7ac3e030-7933-47e6-8c5c-01b2b9783bf3 X-Runtime: 0.008558 Vary: Origin
The server outputs:
web_1 | I, [2017-06-29T14:28:01.117956 #7] INFO -- : Redirected to http://example.com web_1 | I, [2017-06-29T14:28:01.118053 #7] INFO -- : Completed 302 Found in 4ms (ActiveRecord: 0.3ms)
Which sounds like it works, but like I forgot to edit a couple of settings somewhere...
- [x] Change `example.com` for `localhost:3000` in `config/settings/development.local.yml`... ⚠️
```diff
diff a/config/settings/development.yml b/config/settings/development.local.yml
--- a/config/settings/development.yml
+++ b/config/settings/development.yml
@@ -79,16 +80,16 @@ robots: 'staging'
instantiate_stdout_logger: true
# Defines domain for page URLs
-host: 'http://actions.example.com'
+host: 'http://localhost:3000'
-home_page_url: 'http://example.com'
+home_page_url: 'http://localhost:3000'
default_mailer_address: 'info@example.org'
smtp:
user_name: 'smtp username'
password: 'smtp password'
members:
- dashboard_url: 'http://example.com'
+ dashboard_url: 'http://localhost:3000'
docker-compose run web rake db:reset
and docker-compose run web rake champaign:seed_liquid
docker-compose up
$ curl -I localhost:3000
HTTP/1.1 302 Found
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Location: http://localhost:3000
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
X-Request-Id: d78854fe-a3ac-47fa-bf8f-2dfcf55aebda
X-Runtime: 0.096852
Vary: Origin
And here we go, infinite redirections loop. 💥 And then... I don’t think I can go any farther way by my own. Can you help me out?
Voilà ! 😄
Hey @bmenant! Thanks so much for this!
As you noticed, the README is quite outdated. Tomorrow morning I'll spend some time on it and try to get the app running from scratch as you did, and I'll update the README accordingly.
I'll take a look at your notes more in depth tomorrow, but I can answer some of your points now:
We don't really use Docker for development, all of us in the team at the moment just run the app locally. We use Docker to deploy our app in AWS ElasticBeanstalk. That said, we think it's a good idea to have a setup for Docker for dev, but we believe we might need separate Dockerfiles for production and dev. The work you did is a great starting point for the new dev Dockerfile.
Home page issue and redirect loop: Champaign is built in a way so that when you hit the root path, you get redirected to the "home page". In our case, we have champaign hosted in actions.sumofus.org, and our homepage in www.sumofus.org. So if someone hits http://actions.sumofus.org, they will be redirected to our home page at www.sumofus.org. If your organization has some sort of website, it'd be a good idea to point the redirect there.
The good news is that it seems you got the app running! To start using it go to /pages
, and you'll be redirected to a sign in form. The "Sign in with your SumOfUs email" is a feature that allows sign in via any email account that matches the domain set via ENV variable. For now, don't worry about it. You'll log in via email and password, but you'll need to create an account first. In order to do that go to the console and run: User.create!(email: 'r@r.com', password: '12345678', admin: true)
. After doing that you should be able to log in and start creating pages.
I gotta run now, but I'll be working on the README tomorrow. Let me know if you were able to make any progress. Cheers!
Hey @bmenant, if you'd like to join us on slack we can discuss this and help you get started too.
https://join.slack.com/champaign-core/shared_invite/MjA1NzU5MDg1NTg2LTE0OTg3NTcxNDYtNDU0Mjg3ZjQ1ZQ
Thanks so much for helping me out @rodrei!
Indeed, I was so close!
/pages
:boom:
It says Can't find campaigner_facing.js in /champaign/public/packs/manifest.json. Is webpack still compiling?
Turns out /champaign/public/packs/
doesn’t exist.
There is /champaign/public/packs-test/
though. How come? ⚠️ cp -r public/packs-test public/packs
/pages
http://localhost:3000/action_kit/check_slug
got an internal error: Failed to open TCP connection to actionkit_api_url.com:80
All right, I’ve seen that parameter before. But I don’t want to use it for now. Is ActionKit a requisite? Can we disable this integration? ⚠️
This a very important point by the way, since we’re not about to use ActionKit and it is very likely that we’ll have to integrate another CRM to Champlain.Thanks for the Slack invitation. I won’t be there tomorrow. See you next week.
Hey @bmenant! AK should be optional, but it seems that slipped through the cracks, I'll push a fix for that and let you know.
Hi there,
Benjamin here from Agir pour l’Environnement (French NGO). We’re looking for a new campaigning software. Since you’ve open-sourced Champaign, I was wondering if there were any intend to really open the project to external contributions and reuses? Or was it a step for transparency at the first place?
From the outside, Champlain looks great! But it’s hard to guess what it actually does. From a NGO perspective, it’s hard to tell whether it’d fit its own needs or not.
So far, the project looks pretty tight to SOU needs and means, doesn’t it? Also, there’s not much documentation available. As a matter of fact, I haven’t succeeded in my efforts to properly install the software on a Docker machine.
I guess some work has to be done to make contributions and adoptions easier. Is this something you’re interested in? If so, can we give a hand, in any manner?