~hacktivista/hacktivista.com

Tienda hacktivista.com
CartItem model tests
ShippingAddress model tests
Product model tests

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~hacktivista/hacktivista.com
read/write
git@git.sr.ht:~hacktivista/hacktivista.com

You can also use your local clone with git send-email.

#Tienda hacktivista.com

Tienda hacktivista.com is built with LeanWeb.

#Deploy

  1. Install server requirements: mariadb-server ruby-full gcc libc6-dev libmariadb-dev.
  2. Setup the following env vars:
    • RACK_ENV: development or anything else, which means production.
    • ENVIAME_QUOTE_API_KEY: Enviame.io Quote API key.
    • HAWESE_ENDPOINT: Hawese-payment endpoint.
    • HACKTIVISTA_COM_PAYMENT_AUTH_TOKEN: Payment token used for connection with Hawese.
    • HACKTIVISTA_COM_ENDPOINT: This instance's URL, used for Hawese return url and emails.
    • HACKTIVISTA_COM_DATABASE_URL: MariaDB/MySQL database according to the Sequel docs format, using the mysql2 driver.
    • HACKTIVISTA_COM_NOTIFICATION_EMAILS: Comma-separated emails to which send subscription and purchase notifications.
    • SMTP_HOST: SMTP host to connect.
    • SMTP_FROM: In the format Name <user@mail> or user@mail.
    • SMTP_SECURITY: tls or starttls, otherwise no encryption, optional.
    • SMTP_PORT: SMTP port, optional (default: 25).
    • SMTP_USER: SMTP user, optional.
    • SMTP_PASSWORD: SMTP password, optional.
  3. bundle exec rake migrate && bundle exec rake update_stock.
  4. If not on development environment, build static pages with bundle exec rake build_static.
  5. bundle exec rake serve.
  6. If on production, setup a static server to serve static files on public/.
  7. Enjoy :)

Or, you can simply download setup.sh on a Debian 11 machine and setup hacktivista.com according to the instructions on that same file.

#Configure Hawese

Please note that you will need to configure Hawese properly in order to accept this origin and be able to receive instant payment notifications.

  1. Properly install Hawese.
  2. Copy vendor/hawese-payment/config/payment.php to config/payment.php.
  3. Append a proper config* to the origins array.
  4. Append $app->configure('payment'); under custom configuration on bootstrap/app.php
  5. Set the PAYMENT_HACKTIVISTA_COM_AUTH_TOKEN env var on Hawese to the same value than HACKTIVISTA_COM_PAYMENT_AUTH_TOKEN on Tienda hacktivista.com.

* Proper config, change urls if needed:

'hacktivista_com' => [
    'return_url' => env('PAYMENT_HACKTIVISTA_COM_ENDPOINT') . '/checkout',
    'notify' => [
        'status' => ['completed', 'aborted'],
        'uri' => env('PAYMENT_HACKTIVISTA_COM_ENDPOINT') . '/verify-payment',
        'headers' => [
            'Content-Type' => 'application/json',
            'Authorization' => 'Bearer ' .
                env('PAYMENT_HACKTIVISTA_COM_AUTH_TOKEN'),
        ],
        'method' => 'POST',
        'params' => [
            'status' => 'payment.status',
            'uuid' => 'payment.uuid'
        ],
    ],
],

#Running tests

Setup a HACKTIVISTA_COM_DATABASE_URL env var on a file named .env.testing according to Sequel docs, using the mysql2 driver.

Add the RACK_ENV=testing env var to that same file.

Run specs with the command bundle exec rake spec.

#FAQ

#How to restore database to its initial state?

bundle exec rake migrate[0] && bundle exec rake migrate

(probably you'll want to bundle exec rake update_stock too)

#Reciprocity

If you profit out of this software or in base to its derivation, please remember to give back.

In order to increase awareness and create a saner socioeconomic system for libre software I'm providing "reciprocity certificates" that will allow your clients and friends to know that you are contributing back instead of just free riding. To support our work and receive your certificate go to https://hacktivista.org/reciprocity.

#License

Tienda Hacktivista.com is libre software released under the Hacktivista General Public License 0.1 or any later version. Which means that it works exactly like the GNU AGPL license but every copy counts as a distribution, even for "internal use".

This license by no means prohibits the private usage of covered works. Private usage and modification is always allowed but never enforced. Thus, this license holds a stronger, purely libre copyleft stance.

To comply with the terms of the license, if you modify this software you must prominently provide the means to access the source code of your version of the software easily and free of charge to anyone who has access to it, including users accessing it through a network (i.e., web browser).

Any modification or inclusion of this source code will inherit the same license, that is, it cannot be sublicensed.

At this time I don't recommend the use of this license for non-derivative works, since it's a work in progress expecting changes and validation by competent lawyers. On derivative works please remember to license it under current version "or any later version", so you can be sure your code is covered by the legally safest version.